feat: final report and code

This commit is contained in:
Krzysztof Rudnicki 2023-05-16 23:36:41 +02:00
parent 6976e6aa0c
commit 8d40eb6078
3 changed files with 115 additions and 9 deletions

View File

@ -266,13 +266,7 @@ if __name__ == "__main__":
NUM_HIDDEN_LAYERS = 2
WIDTH = 128
OPTIMIZER_TYPE = 'Adam'
print("0/2")
main_part(True)
print("1/2")
BATCH_SIZE = 64
NUM_HIDDEN_LAYERS = 0
main_part(True)
print("2/2")
"""
learning_rate_values = [0.1, 0.01, 0.001]
i = 0

View File

@ -90,11 +90,13 @@ We have successfully implemented network analyzing MNIST dataset \\
\end{figure}
\begin{figure}[H]
\minipage{0.5\textwidth}%
\includegraphics[width=\linewidth]{testsResults/loss/lr/def.png}
\includegraphics[width=\linewidth]{testsResults/loss/lr/loss-lr0.1-bs64-hl2-w128-Adam.png}
\caption{Default settings + learning rate = 0.1}
\endminipage
\end{figure}
\paragraph{Analysis} Smaller learning rate causes losses to drop near zero level faster (notice how there is a vertical drop for lower learning step for leaerning rate 0.001, later for learning rate 0.01 and never for learnig rate 0.1)
\subsubsection{Mini-Batch size}
\begin{figure}[H]
@ -118,6 +120,8 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Batching size equal to 1 makes losses seem pretty much random, increasing batch sizes increases 'flat' (smaller) loss periods between local peaks
\subsubsection{Number of Hidden Layers}
\begin{figure}[H]
@ -140,7 +144,8 @@ We have successfully implemented network analyzing MNIST dataset \\
\caption{Default settings + hidden layers = 3}
\endminipage
\end{figure}
\newpage
\paragraph{Analysis} Setting hidden layers to 0 again makes losses value seem random, hidden layer set to 1 provides us with later drop but longer flat periods, number of hidden layers set to 2 offeres the opposite and number of layers set to 3 seems to be a compromise between those two
\subsubsection{Width}
\begin{figure}[H]
@ -170,6 +175,9 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Changing width does not seem to affect loss greatly
\subsubsection{Optimizer Type}
\begin{figure}[H]
@ -189,6 +197,9 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Changing optimizers does not seem to affect loss greatly
\subsection{Train Accuracy Graphs}
\subsubsection{Learning Rate}
@ -210,6 +221,8 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Making training accuracy smaller than 0.01 seems to be unnecessary for this dataset as it offers little to no improve in accuracy. Setting it to 0.1 on the other hand provides very low accuracy of neural network
\subsubsection{Mini-Batch size}
\begin{figure}[H]
@ -233,6 +246,11 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Increasing batching size does not seem to make drastic change for train accuracy, even setting batching size to 1 offers very good (over 95 \%) accuracy
\subsubsection{Number of Hidden Layers}
\begin{figure}[H]
@ -256,7 +274,7 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\newpage
\paragraph{Analysis} Increasing hidden layers number reduces variety of train accuracy results, with hidden layers set to 0 having accuracy vary between 91 and 98 and with hidden layers equal to 3 showing much smoother graph
\subsubsection{Width}
\begin{figure}[H]
@ -286,6 +304,8 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Changing width does not seem to influence accuracy much
\subsubsection{Optimizer Type}
\begin{figure}[H]
@ -305,7 +325,10 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\paragraph{Analysis} Changing optimizer type does not seem to influence accuracy much
\subsection{Validation Accuracy Graphs}
Validation Accuracy Graphs look similar to Train accuracy so in order not to repeat ourselves we ommited analysis of them
\subsubsection{Learning Rate}
@ -421,5 +444,94 @@ We have successfully implemented network analyzing MNIST dataset \\
\endminipage
\end{figure}
\subsection{Speed}
We also checked how different parameters impact speed of the neural network learning
\paragraph{Changing learning rate}
\begin{center}
\begin{tabular}{ | c | c | }
\hline
Learning rate & Execution Time [s] \\
\hline
0.001 (default) & 49.3 \\
\hline
0.01 & 53.9 \\
\hline
0.1 & 50.1 \\
\hline
\end{tabular}
\end{center}
\paragraph{Changing batch size}
\begin{center}
\begin{tabular}{ | c | c | }
\hline
Batch Size & Execution Time [s] \\
\hline
1 & 567.2 (!) \\
\hline
64 (default) & 49.3 \\
\hline
128 & 48.1 \\
\hline
256 & 42.8 \\
\hline
\end{tabular}
\end{center}
\paragraph{Changing number of hidden layers}
\begin{center}
\begin{tabular}{ | c | c | }
\hline
Hidden layers & Execution Time [s] \\
\hline
0 & 44.5 \\
\hline
1 & 48.8 \\
\hline
2 (default) & 49.3 \\
\hline
3 & 48.7 \\
\hline
\end{tabular}
\end{center}
\paragraph{Changing width}
\begin{center}
\begin{tabular}{ | c | c | }
\hline
Width & Execution Time [s] \\
\hline
64 & 46.7 \\
\hline
128 (default) & 49.3 \\
\hline
256 & 49.0 \\
\hline
512 & 52.1 \\
\hline
1024 & 73.9 \\
\hline
\end{tabular}
\end{center}
\paragraph{Changing optimizer type}
\begin{center}
\begin{tabular}{ | c | c | }
\hline
Learning rate & Execution Time [s] \\
\hline
Adam (default) & 49.3 \\
\hline
SGD & 45.1 \\
\hline
SGD Momentum & 45.5 \\
\hline
\end{tabular}
\end{center}
\paragraph{Analysis}
Two parameters that had the biggest impact on execution time was setting batch size to extremely low value (1) and increasing width (jump between 512 width and 1024 is equal to 20 seconds more execution time)
\end{document}