[newbie] Fluctuations and overfitting in first epochs

hip: <p>Hey everyone,</p>
<p>I am training an ML model on PyTorch using the DVS Gesture dataset. However, I am facing some issues in the training process, it shows a lot of fluctuations as well as a gap (of 5~6%) between training accuracy and validation accuracy from the first epochs, and the gap keeps increasing during the training (up to 20%).</p>
<p>I have tried several approaches such as :</p>
<ul>
<li>
<p>Normalizing (I make it worse, in the begging, the gap is reduced then it gets bigger, and the network start to overfitting early, validation accuracy doesn’t overcome 30%)</p>
</li>
<li>
<p>I am sure that the data are perfectly merged and randomly split, but I can not use a data augmentation because of the data shape (5D tensor)</p>
</li>
<li>
<p>Architecture, I have tried many from the most complex to the simplest</p>
</li>
<li>
<p>Dropout, with a high drop out the gap, disappear in the first epochs (even sometimes validation accuracy is better than training) but over epochs, it reappears as usual.</p>
</li>
<li>
<p>Regularization, just like dropout, it has a good effect in the first epochs, then as if it doesn’t exist, I even tried a weight decay of 1.</p>
</li>
<li>
<p>Batch size, I tried from 16 to 256, it reduces fluctuations but never disappears.</p>
</li>
<li>
<p>Learning rate, regardless of its value, the fluctuations don’t make sense, usually when LR is high both training and validation accuracies drop, but in my case, it is random, one drops while the other improves.</p>
</li>
<li>
<p>Scheduler (ReduceLROnPlateau) doesn’t improve anything, the gap gets bigger.</p>
</li>
</ul>
<p>Regardless of all hyperparameters change, the fluctuations occurs with a certain pattern and couldn’t overcome it.</p>
<p>Here is a colab link to the model : <a href="https://colab.research.google.com/drive/1Gv-LrE1kUC5SHfDYEd74tw9QOZK-BwSy?usp=sharing" class="inline-onebox" rel="noopener nofollow ugc">Google Colab</a></p>

hip: <p>Here is some results:</p>
<h2>
<a name="train-set-accuracy-1758-1" class="anchor" href="#train-set-accuracy-1758-1"></a>Train set accuracy: 17.58%</h2>
<h2>
<a name="epoch-0-test-set-accuracy-781-train-set-accuracy-859-2" class="anchor" href="#epoch-0-test-set-accuracy-781-train-set-accuracy-859-2"></a>Epoch: 0<br>
Test set accuracy: 7.81%<br>
Train set accuracy: 8.59%</h2>
<h2>
<a name="epoch-1-test-set-accuracy-1016-train-set-accuracy-859-3" class="anchor" href="#epoch-1-test-set-accuracy-1016-train-set-accuracy-859-3"></a>Epoch: 1<br>
Test set accuracy: 10.16%<br>
Train set accuracy: 8.59%</h2>
<h2>
<a name="epoch-2-test-set-accuracy-1719-train-set-accuracy-1211-4" class="anchor" href="#epoch-2-test-set-accuracy-1719-train-set-accuracy-1211-4"></a>Epoch: 2<br>
Test set accuracy: 17.19%<br>
Train set accuracy: 12.11%</h2>
<h2>
<a name="epoch-3-test-set-accuracy-1406-train-set-accuracy-2051-5" class="anchor" href="#epoch-3-test-set-accuracy-1406-train-set-accuracy-2051-5"></a>Epoch: 3<br>
Test set accuracy: 14.06%<br>
Train set accuracy: 20.51%</h2>
<h2>
<a name="epoch-4-test-set-accuracy-781-train-set-accuracy-1230-6" class="anchor" href="#epoch-4-test-set-accuracy-781-train-set-accuracy-1230-6"></a>Epoch: 4<br>
Test set accuracy: 7.81%<br>
Train set accuracy: 12.30%</h2>
<h2>
<a name="epoch-5-test-set-accuracy-1367-train-set-accuracy-1113-7" class="anchor" href="#epoch-5-test-set-accuracy-1367-train-set-accuracy-1113-7"></a>Epoch: 5<br>
Test set accuracy: 13.67%<br>
Train set accuracy: 11.13%</h2>
<h2>
<a name="epoch-6-test-set-accuracy-1719-train-set-accuracy-1328-8" class="anchor" href="#epoch-6-test-set-accuracy-1719-train-set-accuracy-1328-8"></a>Epoch: 6<br>
Test set accuracy: 17.19%<br>
Train set accuracy: 13.28%</h2>
<h2>
<a name="epoch-7-test-set-accuracy-1523-train-set-accuracy-1797-9" class="anchor" href="#epoch-7-test-set-accuracy-1523-train-set-accuracy-1797-9"></a>Epoch: 7<br>
Test set accuracy: 15.23%<br>
Train set accuracy: 17.97%</h2>
<h2>
<a name="epoch-8-test-set-accuracy-1484-train-set-accuracy-1250-10" class="anchor" href="#epoch-8-test-set-accuracy-1484-train-set-accuracy-1250-10"></a>Epoch: 8<br>
Test set accuracy: 14.84%<br>
Train set accuracy: 12.50%</h2>
<h2>
<a name="epoch-9-test-set-accuracy-1641-train-set-accuracy-1699-11" class="anchor" href="#epoch-9-test-set-accuracy-1641-train-set-accuracy-1699-11"></a>Epoch: 9<br>
Test set accuracy: 16.41%<br>
Train set accuracy: 16.99%</h2>
<h2>
<a name="epoch-10-test-set-accuracy-1484-train-set-accuracy-1699-12" class="anchor" href="#epoch-10-test-set-accuracy-1484-train-set-accuracy-1699-12"></a>Epoch: 10<br>
Test set accuracy: 14.84%<br>
Train set accuracy: 16.99%</h2>
<h2>
<a name="epoch-11-test-set-accuracy-2188-train-set-accuracy-2148-13" class="anchor" href="#epoch-11-test-set-accuracy-2188-train-set-accuracy-2148-13"></a>Epoch: 11<br>
Test set accuracy: 21.88%<br>
Train set accuracy: 21.48%</h2>
<h2>
<a name="epoch-12-test-set-accuracy-2617-train-set-accuracy-2363-14" class="anchor" href="#epoch-12-test-set-accuracy-2617-train-set-accuracy-2363-14"></a>Epoch: 12<br>
Test set accuracy: 26.17%<br>
Train set accuracy: 23.63%</h2>
<h2>
<a name="epoch-13-test-set-accuracy-2578-train-set-accuracy-2793-15" class="anchor" href="#epoch-13-test-set-accuracy-2578-train-set-accuracy-2793-15"></a>Epoch: 13<br>
Test set accuracy: 25.78%<br>
Train set accuracy: 27.93%</h2>
<h2>
<a name="epoch-14-test-set-accuracy-3750-train-set-accuracy-3184-16" class="anchor" href="#epoch-14-test-set-accuracy-3750-train-set-accuracy-3184-16"></a>Epoch: 14<br>
Test set accuracy: 37.50%<br>
Train set accuracy: 31.84%</h2>
<h2>
<a name="epoch-15-test-set-accuracy-3281-train-set-accuracy-3379-17" class="anchor" href="#epoch-15-test-set-accuracy-3281-train-set-accuracy-3379-17"></a>Epoch: 15<br>
Test set accuracy: 32.81%<br>
Train set accuracy: 33.79%</h2>
<h2>
<a name="epoch-16-test-set-accuracy-1914-train-set-accuracy-1504-18" class="anchor" href="#epoch-16-test-set-accuracy-1914-train-set-accuracy-1504-18"></a>Epoch: 16<br>
Test set accuracy: 19.14%<br>
Train set accuracy: 15.04%</h2>
<h2>
<a name="epoch-17-test-set-accuracy-1445-train-set-accuracy-1719-19" class="anchor" href="#epoch-17-test-set-accuracy-1445-train-set-accuracy-1719-19"></a>Epoch: 17<br>
Test set accuracy: 14.45%<br>
Train set accuracy: 17.19%</h2>
<h2>
<a name="epoch-18-test-set-accuracy-2891-train-set-accuracy-2754-20" class="anchor" href="#epoch-18-test-set-accuracy-2891-train-set-accuracy-2754-20"></a>Epoch: 18<br>
Test set accuracy: 28.91%<br>
Train set accuracy: 27.54%</h2>
<h2>
<a name="epoch-19-test-set-accuracy-3164-train-set-accuracy-3320-21" class="anchor" href="#epoch-19-test-set-accuracy-3164-train-set-accuracy-3320-21"></a>Epoch: 19<br>
Test set accuracy: 31.64%<br>
Train set accuracy: 33.20%</h2>
<h2>
<a name="epoch-20-test-set-accuracy-3633-train-set-accuracy-3594-22" class="anchor" href="#epoch-20-test-set-accuracy-3633-train-set-accuracy-3594-22"></a>Epoch: 20<br>
Test set accuracy: 36.33%<br>
Train set accuracy: 35.94%</h2>
<h2>
<a name="epoch-21-test-set-accuracy-4531-train-set-accuracy-4121-23" class="anchor" href="#epoch-21-test-set-accuracy-4531-train-set-accuracy-4121-23"></a>Epoch: 21<br>
Test set accuracy: 45.31%<br>
Train set accuracy: 41.21%</h2>
<h2>
<a name="epoch-22-test-set-accuracy-3594-train-set-accuracy-3789-24" class="anchor" href="#epoch-22-test-set-accuracy-3594-train-set-accuracy-3789-24"></a>Epoch: 22<br>
Test set accuracy: 35.94%<br>
Train set accuracy: 37.89%</h2>
<h2>
<a name="epoch-23-test-set-accuracy-3984-train-set-accuracy-4316-25" class="anchor" href="#epoch-23-test-set-accuracy-3984-train-set-accuracy-4316-25"></a>Epoch: 23<br>
Test set accuracy: 39.84%<br>
Train set accuracy: 43.16%</h2>
<h2>
<a name="epoch-24-test-set-accuracy-4570-train-set-accuracy-4883-26" class="anchor" href="#epoch-24-test-set-accuracy-4570-train-set-accuracy-4883-26"></a>Epoch: 24<br>
Test set accuracy: 45.70%<br>
Train set accuracy: 48.83%</h2>
<h2>
<a name="epoch-25-test-set-accuracy-4570-train-set-accuracy-4707-27" class="anchor" href="#epoch-25-test-set-accuracy-4570-train-set-accuracy-4707-27"></a>Epoch: 25<br>
Test set accuracy: 45.70%<br>
Train set accuracy: 47.07%</h2>
<h2>
<a name="epoch-26-test-set-accuracy-4531-train-set-accuracy-4805-28" class="anchor" href="#epoch-26-test-set-accuracy-4531-train-set-accuracy-4805-28"></a>Epoch: 26<br>
Test set accuracy: 45.31%<br>
Train set accuracy: 48.05%</h2>
<h2>
<a name="epoch-27-test-set-accuracy-4961-train-set-accuracy-5117-29" class="anchor" href="#epoch-27-test-set-accuracy-4961-train-set-accuracy-5117-29"></a>Epoch: 27<br>
Test set accuracy: 49.61%<br>
Train set accuracy: 51.17%</h2>
<h2>
<a name="epoch-28-test-set-accuracy-4688-train-set-accuracy-5254-30" class="anchor" href="#epoch-28-test-set-accuracy-4688-train-set-accuracy-5254-30"></a>Epoch: 28<br>
Test set accuracy: 46.88%<br>
Train set accuracy: 52.54%</h2>
<h2>
<a name="epoch-29-test-set-accuracy-4258-train-set-accuracy-5293-31" class="anchor" href="#epoch-29-test-set-accuracy-4258-train-set-accuracy-5293-31"></a>Epoch: 29<br>
Test set accuracy: 42.58%<br>
Train set accuracy: 52.93%</h2>
<h2>
<a name="epoch-30-test-set-accuracy-4414-train-set-accuracy-5039-32" class="anchor" href="#epoch-30-test-set-accuracy-4414-train-set-accuracy-5039-32"></a>Epoch: 30<br>
Test set accuracy: 44.14%<br>
Train set accuracy: 50.39%</h2>
<h2>
<a name="epoch-31-test-set-accuracy-5000-train-set-accuracy-5547-33" class="anchor" href="#epoch-31-test-set-accuracy-5000-train-set-accuracy-5547-33"></a>Epoch: 31<br>
Test set accuracy: 50.00%<br>
Train set accuracy: 55.47%</h2>
<h2>
<a name="epoch-32-test-set-accuracy-5078-train-set-accuracy-5566-34" class="anchor" href="#epoch-32-test-set-accuracy-5078-train-set-accuracy-5566-34"></a>Epoch: 32<br>
Test set accuracy: 50.78%<br>
Train set accuracy: 55.66%</h2>
<h2>
<a name="epoch-33-test-set-accuracy-5156-train-set-accuracy-5664-35" class="anchor" href="#epoch-33-test-set-accuracy-5156-train-set-accuracy-5664-35"></a>Epoch: 33<br>
Test set accuracy: 51.56%<br>
Train set accuracy: 56.64%</h2>
<h2>
<a name="epoch-34-test-set-accuracy-5273-train-set-accuracy-5781-36" class="anchor" href="#epoch-34-test-set-accuracy-5273-train-set-accuracy-5781-36"></a>Epoch: 34<br>
Test set accuracy: 52.73%<br>
Train set accuracy: 57.81%</h2>
<h2>
<a name="epoch-35-test-set-accuracy-5039-train-set-accuracy-5840-37" class="anchor" href="#epoch-35-test-set-accuracy-5039-train-set-accuracy-5840-37"></a>Epoch: 35<br>
Test set accuracy: 50.39%<br>
Train set accuracy: 58.40%</h2>
<h2>
<a name="epoch-36-test-set-accuracy-4844-train-set-accuracy-5684-38" class="anchor" href="#epoch-36-test-set-accuracy-4844-train-set-accuracy-5684-38"></a>Epoch: 36<br>
Test set accuracy: 48.44%<br>
Train set accuracy: 56.84%</h2>
<h2>
<a name="epoch-37-test-set-accuracy-5273-train-set-accuracy-5586-39" class="anchor" href="#epoch-37-test-set-accuracy-5273-train-set-accuracy-5586-39"></a>Epoch: 37<br>
Test set accuracy: 52.73%<br>
Train set accuracy: 55.86%</h2>
<h2>
<a name="epoch-38-test-set-accuracy-5273-train-set-accuracy-5703-40" class="anchor" href="#epoch-38-test-set-accuracy-5273-train-set-accuracy-5703-40"></a>Epoch: 38<br>
Test set accuracy: 52.73%<br>
Train set accuracy: 57.03%</h2>
<h2>
<a name="epoch-39-test-set-accuracy-5078-train-set-accuracy-5684-41" class="anchor" href="#epoch-39-test-set-accuracy-5078-train-set-accuracy-5684-41"></a>Epoch: 39<br>
Test set accuracy: 50.78%<br>
Train set accuracy: 56.84%</h2>
<h2>
<a name="epoch-40-test-set-accuracy-5039-train-set-accuracy-5508-42" class="anchor" href="#epoch-40-test-set-accuracy-5039-train-set-accuracy-5508-42"></a>Epoch: 40<br>
Test set accuracy: 50.39%<br>
Train set accuracy: 55.08%</h2>
<h2>
<a name="epoch-41-test-set-accuracy-5078-train-set-accuracy-5820-43" class="anchor" href="#epoch-41-test-set-accuracy-5078-train-set-accuracy-5820-43"></a>Epoch: 41<br>
Test set accuracy: 50.78%<br>
Train set accuracy: 58.20%</h2>
<h2>
<a name="epoch-42-test-set-accuracy-4961-train-set-accuracy-5625-44" class="anchor" href="#epoch-42-test-set-accuracy-4961-train-set-accuracy-5625-44"></a>Epoch: 42<br>
Test set accuracy: 49.61%<br>
Train set accuracy: 56.25%</h2>
<h2>
<a name="epoch-43-test-set-accuracy-4805-train-set-accuracy-5898-45" class="anchor" href="#epoch-43-test-set-accuracy-4805-train-set-accuracy-5898-45"></a>Epoch: 43<br>
Test set accuracy: 48.05%<br>
Train set accuracy: 58.98%</h2>
<h2>
<a name="epoch-44-test-set-accuracy-5117-train-set-accuracy-5801-46" class="anchor" href="#epoch-44-test-set-accuracy-5117-train-set-accuracy-5801-46"></a>Epoch: 44<br>
Test set accuracy: 51.17%<br>
Train set accuracy: 58.01%</h2>
<h2>
<a name="epoch-45-test-set-accuracy-5117-train-set-accuracy-6035-47" class="anchor" href="#epoch-45-test-set-accuracy-5117-train-set-accuracy-6035-47"></a>Epoch: 45<br>
Test set accuracy: 51.17%<br>
Train set accuracy: 60.35%</h2>
<h2>
<a name="epoch-46-test-set-accuracy-5117-train-set-accuracy-5957-48" class="anchor" href="#epoch-46-test-set-accuracy-5117-train-set-accuracy-5957-48"></a>Epoch: 46<br>
Test set accuracy: 51.17%<br>
Train set accuracy: 59.57%</h2>
<h2>
<a name="epoch-47-test-set-accuracy-5078-train-set-accuracy-6074-49" class="anchor" href="#epoch-47-test-set-accuracy-5078-train-set-accuracy-6074-49"></a>Epoch: 47<br>
Test set accuracy: 50.78%<br>
Train set accuracy: 60.74%</h2>
<h2>
<a name="epoch-48-test-set-accuracy-4844-train-set-accuracy-5840-50" class="anchor" href="#epoch-48-test-set-accuracy-4844-train-set-accuracy-5840-50"></a>Epoch: 48<br>
Test set accuracy: 48.44%<br>
Train set accuracy: 58.40%</h2>
<h2>
<a name="epoch-49-test-set-accuracy-4961-train-set-accuracy-5879-51" class="anchor" href="#epoch-49-test-set-accuracy-4961-train-set-accuracy-5879-51"></a>Epoch: 49<br>
Test set accuracy: 49.61%<br>
Train set accuracy: 58.79%</h2>
<h2>
<a name="epoch-50-test-set-accuracy-5078-train-set-accuracy-6152-52" class="anchor" href="#epoch-50-test-set-accuracy-5078-train-set-accuracy-6152-52"></a>Epoch: 50<br>
Test set accuracy: 50.78%<br>
Train set accuracy: 61.52%</h2>
<h2>
<a name="epoch-51-test-set-accuracy-5117-train-set-accuracy-5898-53" class="anchor" href="#epoch-51-test-set-accuracy-5117-train-set-accuracy-5898-53"></a>Epoch: 51<br>
Test set accuracy: 51.17%<br>
Train set accuracy: 58.98%</h2>
<h2>
<a name="epoch-52-test-set-accuracy-5156-train-set-accuracy-5605-54" class="anchor" href="#epoch-52-test-set-accuracy-5156-train-set-accuracy-5605-54"></a>Epoch: 52<br>
Test set accuracy: 51.56%<br>
Train set accuracy: 56.05%</h2>
<h2>
<a name="epoch-53-test-set-accuracy-5156-train-set-accuracy-5859-55" class="anchor" href="#epoch-53-test-set-accuracy-5156-train-set-accuracy-5859-55"></a>Epoch: 53<br>
Test set accuracy: 51.56%<br>
Train set accuracy: 58.59%</h2>
<h2>
<a name="epoch-54-test-set-accuracy-5195-train-set-accuracy-5898-56" class="anchor" href="#epoch-54-test-set-accuracy-5195-train-set-accuracy-5898-56"></a>Epoch: 54<br>
Test set accuracy: 51.95%<br>
Train set accuracy: 58.98%</h2>
<h2>
<a name="epoch-55-test-set-accuracy-5352-train-set-accuracy-6348-57" class="anchor" href="#epoch-55-test-set-accuracy-5352-train-set-accuracy-6348-57"></a>Epoch: 55<br>
Test set accuracy: 53.52%<br>
Train set accuracy: 63.48%</h2>
<h2>
<a name="epoch-56-test-set-accuracy-5430-train-set-accuracy-6133-58" class="anchor" href="#epoch-56-test-set-accuracy-5430-train-set-accuracy-6133-58"></a>Epoch: 56<br>
Test set accuracy: 54.30%<br>
Train set accuracy: 61.33%</h2>
<h2>
<a name="epoch-57-test-set-accuracy-5469-train-set-accuracy-6289-59" class="anchor" href="#epoch-57-test-set-accuracy-5469-train-set-accuracy-6289-59"></a>Epoch: 57<br>
Test set accuracy: 54.69%<br>
Train set accuracy: 62.89%</h2>
<h2>
<a name="epoch-58-test-set-accuracy-5430-train-set-accuracy-6211-60" class="anchor" href="#epoch-58-test-set-accuracy-5430-train-set-accuracy-6211-60"></a>Epoch: 58<br>
Test set accuracy: 54.30%<br>
Train set accuracy: 62.11%</h2>
<p>Epoch: 59<br>
Test set accuracy: 52.73%</p>