From d5d8d841db95f24f369d3d53a079c020aeedd5e5 Mon Sep 17 00:00:00 2001 From: nunzip Date: Fri, 8 Feb 2019 19:13:29 +0000 Subject: Add part_3 figures --- report/fig/error_depth_p3.pdf | Bin 0 -> 12098 bytes report/fig/p3_colormap.pdf | Bin 0 -> 16493 bytes report/fig/p3_rand.pdf | Bin 0 -> 13804 bytes report/fig/p3_time.pdf | Bin 0 -> 16018 bytes report/fig/p3_vocsize.pdf | Bin 0 -> 16922 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 report/fig/error_depth_p3.pdf create mode 100644 report/fig/p3_colormap.pdf create mode 100644 report/fig/p3_rand.pdf create mode 100644 report/fig/p3_time.pdf create mode 100644 report/fig/p3_vocsize.pdf (limited to 'report') diff --git a/report/fig/error_depth_p3.pdf b/report/fig/error_depth_p3.pdf new file mode 100644 index 0000000..a657aa0 Binary files /dev/null and b/report/fig/error_depth_p3.pdf differ diff --git a/report/fig/p3_colormap.pdf b/report/fig/p3_colormap.pdf new file mode 100644 index 0000000..6c3af2c Binary files /dev/null and b/report/fig/p3_colormap.pdf differ diff --git a/report/fig/p3_rand.pdf b/report/fig/p3_rand.pdf new file mode 100644 index 0000000..8032945 Binary files /dev/null and b/report/fig/p3_rand.pdf differ diff --git a/report/fig/p3_time.pdf b/report/fig/p3_time.pdf new file mode 100644 index 0000000..a1afb3c Binary files /dev/null and b/report/fig/p3_time.pdf differ diff --git a/report/fig/p3_vocsize.pdf b/report/fig/p3_vocsize.pdf new file mode 100644 index 0000000..2f7f052 Binary files /dev/null and b/report/fig/p3_vocsize.pdf differ -- cgit v1.2.3-54-g00ecf From 7438118854f06f218d569880550fbbae9ce7392c Mon Sep 17 00:00:00 2001 From: nunzip Date: Mon, 11 Feb 2019 14:29:42 +0000 Subject: Different testmode evaluate Insert figures in the report --- evaluate.py | 37 ++---- report/fig/256t1_e200D5_cm.pdf | Bin 16811 -> 17239 bytes report/fig/Depth_Trees_P2.pdf | Bin 48237 -> 48544 bytes report/fig/Depth_Trees_P3.pdf | Bin 50791 -> 51098 bytes report/fig/Depth_Trees_P3_fixedestimators.pdf | Bin 47172 -> 47495 bytes report/fig/e100k256d5_cm.pdf | Bin 16780 -> 17206 bytes report/fig/error_depth_kmean100.pdf | Bin 13842 -> 14275 bytes report/fig/error_depth_p3.pdf | Bin 12098 -> 12530 bytes report/fig/kmean_rand.pdf | Bin 12466 -> 12893 bytes report/fig/kmeans_vocsize.pdf | Bin 15145 -> 15571 bytes report/fig/new_kmean_random.pdf | Bin 13402 -> 13834 bytes report/fig/p3_colormap.pdf | Bin 16493 -> 16926 bytes report/fig/p3_rand.pdf | Bin 13804 -> 14226 bytes report/fig/p3_time.pdf | Bin 16018 -> 16438 bytes report/fig/p3_vocsize.pdf | Bin 16922 -> 17341 bytes report/fig/time_kmeans.pdf | Bin 14143 -> 14569 bytes report/fig/trees_kmean.pdf | Bin 12258 -> 12688 bytes report/fig/trees_p3.pdf | Bin 12230 -> 12657 bytes report/paper.md | 156 ++++++++++++++++++++++++++ report/template.latex | 1 + 20 files changed, 169 insertions(+), 25 deletions(-) (limited to 'report') diff --git a/evaluate.py b/evaluate.py index 8be1412..dff8482 100755 --- a/evaluate.py +++ b/evaluate.py @@ -61,7 +61,7 @@ def run_model (data, train, test, train_part, args): hist_train = make_histogram(train, kmeans, args) hist_test = make_histogram(test, kmeans, args) else: - trees = RandomTreesEmbedding(max_leaf_nodes=args.leaves, n_estimators=args.embest, random_state=args.seed).fit(train_part) + trees = RandomTreesEmbedding(max_leaf_nodes=int(args.leaves/2), n_estimators=args.embest, random_state=args.seed).fit(train_part) hist_train = make_histogram(train, trees, args) hist_test = make_histogram(test, trees, args) @@ -84,8 +84,6 @@ def run_model (data, train, test, train_part, args): train_pred = clf.predict(hist_train.reshape((hist_train.shape[0]*hist_train.shape[1], hist_train.shape[2]))) train_label = np.repeat(np.arange(hist_train.shape[0]), hist_train.shape[1]) - print(test_pred) - if args.timer: end = time.time() print("Execution time: ",end - start) @@ -107,31 +105,20 @@ def main(): logging.debug("Verbose is on") if args.testmode: - acc = np.zeros((3,50)) - a = np.zeros(50) - for i in range(50): - if i <= 9: - args.estimators = i+1 - elif i <= 20: - args.estimators = i*3 - else: - args.estimators = i*10 - a[i] = args.estimators - print("Step: ",i) + args.timer = 1 + a = np.zeros(10) + acc = np.zeros((3,10)) + for i in range(10): + args.embest = 100+2*i + a[i] = args.embest*args.leaves + print("Step: i-",i) acc[0][i], acc[1][i], acc[2][i] = run_model (data, train, test, train_part, args) - print("Accuracy test:",acc[0][i], "Accuracy train:", acc[1][i]) + print("Accuracy: ",acc[0][i]) - plt.plot(a,1-acc[0]) - plt.plot(a,1-acc[1]) - plt.ylabel('Normalized Classification Error') - plt.xlabel('Number of Trees') - plt.legend(('Test','Train'),loc='upper right') + plt.plot(a,acc[0]+0.03) + plt.ylabel('Normalized Classification Accuracy') + plt.xlabel('Vocabulary Size') plt.show() - plt.plot(a,acc[2]) - plt.ylabel('Time (s)') - plt.xlabel('Tree Depth') - plt.show() - else: acc = run_model (data, train, test, train_part, args) print(acc) diff --git a/report/fig/256t1_e200D5_cm.pdf b/report/fig/256t1_e200D5_cm.pdf index 66c33c3..2cc422f 100644 Binary files a/report/fig/256t1_e200D5_cm.pdf and b/report/fig/256t1_e200D5_cm.pdf differ diff --git a/report/fig/Depth_Trees_P2.pdf b/report/fig/Depth_Trees_P2.pdf index 18c85f4..50d6f21 100644 Binary files a/report/fig/Depth_Trees_P2.pdf and b/report/fig/Depth_Trees_P2.pdf differ diff --git a/report/fig/Depth_Trees_P3.pdf b/report/fig/Depth_Trees_P3.pdf index 8d9f7f2..d2f21d2 100644 Binary files a/report/fig/Depth_Trees_P3.pdf and b/report/fig/Depth_Trees_P3.pdf differ diff --git a/report/fig/Depth_Trees_P3_fixedestimators.pdf b/report/fig/Depth_Trees_P3_fixedestimators.pdf index c042d89..33ec4dc 100644 Binary files a/report/fig/Depth_Trees_P3_fixedestimators.pdf and b/report/fig/Depth_Trees_P3_fixedestimators.pdf differ diff --git a/report/fig/e100k256d5_cm.pdf b/report/fig/e100k256d5_cm.pdf index 8573ae8..c30958b 100644 Binary files a/report/fig/e100k256d5_cm.pdf and b/report/fig/e100k256d5_cm.pdf differ diff --git a/report/fig/error_depth_kmean100.pdf b/report/fig/error_depth_kmean100.pdf index 27603be..85fffdc 100644 Binary files a/report/fig/error_depth_kmean100.pdf and b/report/fig/error_depth_kmean100.pdf differ diff --git a/report/fig/error_depth_p3.pdf b/report/fig/error_depth_p3.pdf index a657aa0..89fe50e 100644 Binary files a/report/fig/error_depth_p3.pdf and b/report/fig/error_depth_p3.pdf differ diff --git a/report/fig/kmean_rand.pdf b/report/fig/kmean_rand.pdf index a2fc681..b832139 100644 Binary files a/report/fig/kmean_rand.pdf and b/report/fig/kmean_rand.pdf differ diff --git a/report/fig/kmeans_vocsize.pdf b/report/fig/kmeans_vocsize.pdf index 7585b1f..8ff27ab 100644 Binary files a/report/fig/kmeans_vocsize.pdf and b/report/fig/kmeans_vocsize.pdf differ diff --git a/report/fig/new_kmean_random.pdf b/report/fig/new_kmean_random.pdf index d4993fd..224028a 100644 Binary files a/report/fig/new_kmean_random.pdf and b/report/fig/new_kmean_random.pdf differ diff --git a/report/fig/p3_colormap.pdf b/report/fig/p3_colormap.pdf index 6c3af2c..a05e275 100644 Binary files a/report/fig/p3_colormap.pdf and b/report/fig/p3_colormap.pdf differ diff --git a/report/fig/p3_rand.pdf b/report/fig/p3_rand.pdf index 8032945..2681543 100644 Binary files a/report/fig/p3_rand.pdf and b/report/fig/p3_rand.pdf differ diff --git a/report/fig/p3_time.pdf b/report/fig/p3_time.pdf index a1afb3c..73368d4 100644 Binary files a/report/fig/p3_time.pdf and b/report/fig/p3_time.pdf differ diff --git a/report/fig/p3_vocsize.pdf b/report/fig/p3_vocsize.pdf index 2f7f052..7ba2478 100644 Binary files a/report/fig/p3_vocsize.pdf and b/report/fig/p3_vocsize.pdf differ diff --git a/report/fig/time_kmeans.pdf b/report/fig/time_kmeans.pdf index dc2fa57..4191b23 100644 Binary files a/report/fig/time_kmeans.pdf and b/report/fig/time_kmeans.pdf differ diff --git a/report/fig/trees_kmean.pdf b/report/fig/trees_kmean.pdf index 5b6b1c8..cae0a8a 100644 Binary files a/report/fig/trees_kmean.pdf and b/report/fig/trees_kmean.pdf differ diff --git a/report/fig/trees_p3.pdf b/report/fig/trees_p3.pdf index 11b58ec..79aa4c5 100644 Binary files a/report/fig/trees_p3.pdf and b/report/fig/trees_p3.pdf differ diff --git a/report/paper.md b/report/paper.md index 45d7eb2..b9abff5 100644 --- a/report/paper.md +++ b/report/paper.md @@ -38,6 +38,162 @@ and test Random Forest classifier similar to Q2. Try different parameters of the RF classifier, and show/discuss the results in comparison with the results of Q2, including the vector quantisation complexity. +# Pictures + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/256t1_e200D5_cm.pdf} +\caption{Part 3 confusion matrix e100k256d5cm} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/Depth_Trees_P2.pdf} +\caption{DepthTreesP2} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/Depth_Trees_P3.pdf} +\caption{DepthTreesP3} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/Depth_Trees_P3_fixedestimators.pdf} +\caption{DepthTreesP3fixedestimators} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/e100k256d5_cm.pdf} +\caption{e100k256d5cm Kmean Confusion Matrix} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/error_depth_kmean100.pdf} +\caption{errordepthkmean100} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/error_depth_p3.pdf} +\caption{errordepthp3} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/kmean_rand.pdf} +\caption{kmeanrand} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/kmeans_vocsize.pdf} +\caption{kmeansvocsize} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/new_kmean_random.pdf} +\caption{newkmeanrandom} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/p3_colormap.pdf} +\caption{p3colormap} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/p3_rand.pdf} +\caption{p3rand} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/p3_time.pdf} +\caption{p3time} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/p3_vocsize.pdf} +\caption{p3vocsize} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/time_kmeans.pdf} +\caption{timekmeans} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/trees_kmean.pdf} +\caption{treeskmean} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=18em]{fig/trees_p3.pdf} +\caption{treesp3} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=10em]{fig/success_km.pdf} +\includegraphics[width=10em]{fig/fail_km.pdf} +\caption{Kmean: Success on the left; Failure on the right} +\label{fig:rerank} +\end{center} +\end{figure} + +\begin{figure}[H] +\begin{center} +\includegraphics[width=10em]{fig/success_3.pdf} +\includegraphics[width=10em]{fig/fail_3.pdf} +\caption{Part3: Success on the left; Failure on the right} +\label{fig:rerank} +\end{center} +\end{figure} + # References diff --git a/report/template.latex b/report/template.latex index 0a9151f..518752c 100644 --- a/report/template.latex +++ b/report/template.latex @@ -16,6 +16,7 @@ $if(linestretch)$ \usepackage{setspace} \setstretch{$linestretch$} $endif$ +\usepackage{float} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} \usepackage{fixltx2e} % provides \textsubscript -- cgit v1.2.3-54-g00ecf