1
$\begingroup$

I am trying to make a Convolutional neural network. Training the images of different brands of Logos. Have 100 images per class and there are 40 classes. I have trained the model now want to check that model is overfitted or not . What should be the number of epochs we will se that with no improvement after which training will be stopped . Should I see after 2, 3 or which number ?

$\endgroup$
1
$\begingroup$

The number of iterations with no improvement is a hyperparameter. Scikit-learn has a default value of 10 in the MLPClassifier but of course you can select one depending on your problem. You can also do a grid search over all your model's hyperparameters.

Another advice I would give is that you could first train the model experimentally for a lot of epochs. If you see it getting stuck for a lot of iterations and then increasing after a halt, then it's better to set a higher value. On the other hand if after a lot of time you don't see it improving you should set the max number of iterations with no improvement to a smaller value.

$\endgroup$
6
  • $\begingroup$ I got it , But As you said if I train the model for a lot of epochs , if it getting stuck a lot of iterations , it is better to set a higher value . To my extent , I read on Internet that at the vary first point , if the accuracy steadily decreases down , that point will be the overfitted but you are saying that if it decreases and then increases then it is OK $\endgroup$ – Hamza Jan 22 at 5:24
  • $\begingroup$ I meant that if the maximum accuracy increases after a lot of iterations its better to set a higher value to the hyperparameter. If the model stays for 3 epochs at around 60 % accuracy, for example 60 , 58 , 59 the best accuracy would be 60. If you have set the hyperparameter to 2 epochs then the training would stop. If however the next epoch was 61 accuracy that would be an improvement you would have seen only if you had set the number of epochs (or iterations) to a number greater than 3. This process is called early stopping $\endgroup$ – Nick Sm Jan 22 at 7:44
  • 1
    $\begingroup$ Thanks Nick , I got it . just tell me last question that there are 4 hyper parameters tuning methods 1) Grid 2) Random 3) Bayesian 4) Manual . As well we use Keras tuner that has also 4 methods . 1) Bayesian 2) Hyperband 3)Random 4)Sklearn . This keras tuner method is different from above 4 methods or above 4 methods falls under this tuner $\endgroup$ – Hamza Jan 22 at 7:58
  • $\begingroup$ No problem, thanks for opening my eyes on hyperparameter tuning methods (I only knew about grid search). After checking the documentation , I concluded that the Sklearn tuner is only meant if you want to tune models from the scikit-learn library. When you create an Sklearn tuner you have to provide one of the other tuners in the library (Bayesian Hyperband, Random,). $\endgroup$ – Nick Sm Jan 22 at 9:37
  • $\begingroup$ Unfortunately I haven't found a grid search tuner in keras but there is one in [scikit](machinelearningmastery.com/… ) . $\endgroup$ – Nick Sm Jan 22 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.