diff options
-rwxr-xr-x | evaluate.py | 37 | ||||
-rw-r--r-- | report/fig/256t1_e200D5_cm.pdf | bin | 16811 -> 17239 bytes | |||
-rw-r--r-- | report/fig/Depth_Trees_P2.pdf | bin | 48237 -> 48544 bytes | |||
-rw-r--r-- | report/fig/Depth_Trees_P3.pdf | bin | 50791 -> 51098 bytes | |||
-rw-r--r-- | report/fig/Depth_Trees_P3_fixedestimators.pdf | bin | 47172 -> 47495 bytes | |||
-rw-r--r-- | report/fig/e100k256d5_cm.pdf | bin | 16780 -> 17206 bytes | |||
-rw-r--r-- | report/fig/error_depth_kmean100.pdf | bin | 13842 -> 14275 bytes | |||
-rw-r--r-- | report/fig/error_depth_p3.pdf | bin | 0 -> 12530 bytes | |||
-rw-r--r-- | report/fig/kmean_rand.pdf | bin | 12466 -> 12893 bytes | |||
-rw-r--r-- | report/fig/kmeans_vocsize.pdf | bin | 15145 -> 15571 bytes | |||
-rw-r--r-- | report/fig/new_kmean_random.pdf | bin | 13402 -> 13834 bytes | |||
-rw-r--r-- | report/fig/p3_colormap.pdf | bin | 0 -> 16926 bytes | |||
-rw-r--r-- | report/fig/p3_rand.pdf | bin | 0 -> 14226 bytes | |||
-rw-r--r-- | report/fig/p3_time.pdf | bin | 0 -> 16438 bytes | |||
-rw-r--r-- | report/fig/p3_vocsize.pdf | bin | 0 -> 17341 bytes | |||
-rw-r--r-- | report/fig/time_kmeans.pdf | bin | 14143 -> 14569 bytes | |||
-rw-r--r-- | report/fig/trees_kmean.pdf | bin | 12258 -> 12688 bytes | |||
-rw-r--r-- | report/fig/trees_p3.pdf | bin | 12230 -> 12657 bytes | |||
-rw-r--r-- | report/paper.md | 156 | ||||
-rw-r--r-- | report/template.latex | 1 |
20 files changed, 169 insertions, 25 deletions
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 Binary files differindex 66c33c3..2cc422f 100644 --- a/report/fig/256t1_e200D5_cm.pdf +++ b/report/fig/256t1_e200D5_cm.pdf diff --git a/report/fig/Depth_Trees_P2.pdf b/report/fig/Depth_Trees_P2.pdf Binary files differindex 18c85f4..50d6f21 100644 --- a/report/fig/Depth_Trees_P2.pdf +++ b/report/fig/Depth_Trees_P2.pdf diff --git a/report/fig/Depth_Trees_P3.pdf b/report/fig/Depth_Trees_P3.pdf Binary files differindex 8d9f7f2..d2f21d2 100644 --- a/report/fig/Depth_Trees_P3.pdf +++ b/report/fig/Depth_Trees_P3.pdf diff --git a/report/fig/Depth_Trees_P3_fixedestimators.pdf b/report/fig/Depth_Trees_P3_fixedestimators.pdf Binary files differindex c042d89..33ec4dc 100644 --- a/report/fig/Depth_Trees_P3_fixedestimators.pdf +++ b/report/fig/Depth_Trees_P3_fixedestimators.pdf diff --git a/report/fig/e100k256d5_cm.pdf b/report/fig/e100k256d5_cm.pdf Binary files differindex 8573ae8..c30958b 100644 --- a/report/fig/e100k256d5_cm.pdf +++ b/report/fig/e100k256d5_cm.pdf diff --git a/report/fig/error_depth_kmean100.pdf b/report/fig/error_depth_kmean100.pdf Binary files differindex 27603be..85fffdc 100644 --- a/report/fig/error_depth_kmean100.pdf +++ b/report/fig/error_depth_kmean100.pdf diff --git a/report/fig/error_depth_p3.pdf b/report/fig/error_depth_p3.pdf Binary files differnew file mode 100644 index 0000000..89fe50e --- /dev/null +++ b/report/fig/error_depth_p3.pdf diff --git a/report/fig/kmean_rand.pdf b/report/fig/kmean_rand.pdf Binary files differindex a2fc681..b832139 100644 --- a/report/fig/kmean_rand.pdf +++ b/report/fig/kmean_rand.pdf diff --git a/report/fig/kmeans_vocsize.pdf b/report/fig/kmeans_vocsize.pdf Binary files differindex 7585b1f..8ff27ab 100644 --- a/report/fig/kmeans_vocsize.pdf +++ b/report/fig/kmeans_vocsize.pdf diff --git a/report/fig/new_kmean_random.pdf b/report/fig/new_kmean_random.pdf Binary files differindex d4993fd..224028a 100644 --- a/report/fig/new_kmean_random.pdf +++ b/report/fig/new_kmean_random.pdf diff --git a/report/fig/p3_colormap.pdf b/report/fig/p3_colormap.pdf Binary files differnew file mode 100644 index 0000000..a05e275 --- /dev/null +++ b/report/fig/p3_colormap.pdf diff --git a/report/fig/p3_rand.pdf b/report/fig/p3_rand.pdf Binary files differnew file mode 100644 index 0000000..2681543 --- /dev/null +++ b/report/fig/p3_rand.pdf diff --git a/report/fig/p3_time.pdf b/report/fig/p3_time.pdf Binary files differnew file mode 100644 index 0000000..73368d4 --- /dev/null +++ b/report/fig/p3_time.pdf diff --git a/report/fig/p3_vocsize.pdf b/report/fig/p3_vocsize.pdf Binary files differnew file mode 100644 index 0000000..7ba2478 --- /dev/null +++ b/report/fig/p3_vocsize.pdf diff --git a/report/fig/time_kmeans.pdf b/report/fig/time_kmeans.pdf Binary files differindex dc2fa57..4191b23 100644 --- a/report/fig/time_kmeans.pdf +++ b/report/fig/time_kmeans.pdf diff --git a/report/fig/trees_kmean.pdf b/report/fig/trees_kmean.pdf Binary files differindex 5b6b1c8..cae0a8a 100644 --- a/report/fig/trees_kmean.pdf +++ b/report/fig/trees_kmean.pdf diff --git a/report/fig/trees_p3.pdf b/report/fig/trees_p3.pdf Binary files differindex 11b58ec..79aa4c5 100644 --- a/report/fig/trees_p3.pdf +++ b/report/fig/trees_p3.pdf diff --git a/report/paper.md b/report/paper.md index 8e821df..037d0df 100644 --- a/report/paper.md +++ b/report/paper.md @@ -40,6 +40,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 |