This commit is contained in:
shoney.arickathil 2023-08-17 06:05:57 +02:00
parent 38db12d6e8
commit 5f47f6b58f
4 changed files with 30 additions and 2 deletions

View file

@ -326,4 +326,32 @@ The steps involved in training a model with \acs{CLR} are as follows :
As illustrated in figure \ref{fig:Loss value at 0.2}, in the graph plotted of Loss Vs Learning rate. The model started to learn at learning rate $\epsilon = 0.04$ onwards. We will further reduce the $max\_lr$.
\item In the next experiment, we set the $max\_lr = 0.04$. \\
Notice in figure \ref{fig:Loss value at 0.04}, there is a plateau until $\epsilon = 0.010$. After which there is a descent until $\epsilon = 0.015$
\begin{figure}[H]
\centering
\includegraphics[scale=0.9]{loss_004.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.04$}
\label{fig:Loss value at 0.04}
\end{figure}
\item In the next experiment, we set the $max\_lr = 0.015$. \\
Notice in figure \ref{fig:Loss value at 0.015}, the loss had not neared zero and the model fails to predict the classification.
\begin{figure}[H]
\centering
\includegraphics[scale=0.9]{loss_0015.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.015$}
\label{fig:Loss value at 0.015}
\end{figure}
\item From the above experiment we concluded that $max\_lr = 0.02$. works.
Notice in figure \ref{fig:Loss value at 0.015}, the loss had not neared zero and the model fails to predict the classification.
\begin{figure}[H]
\centering
\includegraphics[scale=0.9]{loss_002.png}
\caption{Loss vs Learning rate; where $max\_lr = 0.015$}
\label{fig:Loss value at 0.02}
\end{figure}
\end{enumerate}

BIN
doc/images/loss_0015.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/images/loss_002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -16,7 +16,7 @@ class Train():
self.rnn= RNN(self.inputSize, self.n_hidden, self.n_category)
self.lr_low=0.00000000001
self.lr_max=0.04
self.lr_max=0.02
self.learning_rate= 0.00000000000001
self.criterion = nn.NLLLoss()
@ -86,7 +86,7 @@ class Train():
for n_iters in batch:
learn_rates=np.linspace(self.lr_low,self.lr_max,total)
learn_rates=np.linspace(self.lr_low,self.lr_max,n_iters)
for epoch,lr in zip(range(1, n_iters + 1),learn_rates):
self.learning_rate=lr