Learning rate vs. Validation accuracy

Surayuth_Pintawong: <p>I’m working on an image classification model and evaluating my model by using 4-fold cross-validation. I got very high accuracies when I use SGD with lr=0.01. However, the graph of validation accuracy vs. epoch doesn’t look good at all, see Fig.1.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/8/f/8f83f51e543b3261e49456d0306e8ad8268b89b0.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/8f83f51e543b3261e49456d0306e8ad8268b89b0" title="val1.PNG"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/8/f/8f83f51e543b3261e49456d0306e8ad8268b89b0_2_690x157.jpeg" alt="val1.PNG" data-base62-sha1="ktAZKfahjCfkvlHztXzYiCIFGfK" width="690" height="157" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/8/f/8f83f51e543b3261e49456d0306e8ad8268b89b0_2_690x157.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/8/f/8f83f51e543b3261e49456d0306e8ad8268b89b0_2_1035x235.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/8/f/8f83f51e543b3261e49456d0306e8ad8268b89b0_2_1380x314.jpeg 2x" data-dominant-color="F7F6F4"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">val1.PNG</span><span class="informations">2736×623 254 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
<strong>Fig. 1: y-axis and x-axis represent validation acc. and the number of epochs, respectively.</strong></p>
<p>Because it’s really hard to see the trend in the validation accuracy, I tried to lower the learning rate (from lr=0.01 to 0.0005)to see if the graph looks better. The result is shown in Fig 2. I also change the number of epochs from 100 to 200 in this experiment.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/7/070e3af732a3a65a1c3009ee6514949abad92182.png" data-download-href="https://discuss.pytorch.org/uploads/default/070e3af732a3a65a1c3009ee6514949abad92182" title="val2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/070e3af732a3a65a1c3009ee6514949abad92182_2_690x156.png" alt="val2" data-base62-sha1="10pPuZJR0siHaC4PrwtvGCpRMHM" width="690" height="156" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/070e3af732a3a65a1c3009ee6514949abad92182_2_690x156.png, https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/070e3af732a3a65a1c3009ee6514949abad92182_2_1035x234.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/070e3af732a3a65a1c3009ee6514949abad92182_2_1380x312.png 2x" data-dominant-color="FAFAF9"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">val2</span><span class="informations">2769×629 265 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
<strong>Fig. 2: the number of epochs is changed from 100 to 200</strong></p>
<p>Here, the graph looks better (not too much oscillation now) but the overall performance is lower.</p>
<p>The reason that I’m worried about the shape of the validation accuracy is that I want to publish my work in the future but the validation accuracy shown in Fig.1 could convince the reviewers that my training procedure is not right.</p>
<p>So, I would like to know if I should be worried about these things or not as I haven’t published any paper before. Any help or clarification would be appreciated.</p>
<p>Thanks,<br>
Surayuth</p>

ptrblck: <p>Based on the plots it seems that your validation accuracy seems to be very noisy and would also depend on the actual fold. How many samples are in each fold (and the overall dataset) as it seems the number of samples might be quite small?</p>

Surayuth_Pintawong: <p>Thanks for replying. I have a total of 9,724 images in my dataset. The size of the training set is around 75% of 9,724. If I use an even lower learning rate(0.00001), the validation accuracy isn’t noisy now but the accuracy is not good.</p>

mxahan: <aside class="quote no-group" data-username="Surayuth_Pintawong" data-post="1" data-topic="157199">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/surayuth_pintawong/48/30002_2.png" class="avatar"> Surayuth_Pintawong:</div>
<blockquote>
<p>l and evaluating my model by using 4-fold cross-validation. I got very high accuracies when I use SGD with lr=0.0</p>
</blockquote>
</aside>
<p>I was just wondering what model you are using. It may cause such issues.</p>

Surayuth_Pintawong: <p>VGG16 but other models produce similar results.</p>

mxahan: <p>It makes sense as the learning rate is too low. Did you check a higher LR with momentum?</p>

Surayuth_Pintawong: <p>A learning rate that is higher than 0.01 is unstable for me (got nan). All the experiments are done using SGD with momentum=0.9.</p>