0

I am trying to train a model using optuna for hyperparameter optimization. Now in my train function, I am passing all all the train images in the dataset to that model in batches of 4.

Say I have 20 images so that means 20/4 = 5 batches of my dataset are being passed to my model. I have not added the concept of epochs.

Now I integrate optuna into my code to find the best learning rate and optimizer and I get the output for different trials of optuna. output for optuna trials=5

Now I want to understand that does one trial mean one epoch since one trial has gone over my entire dataset in batches? Or do trials work differently from epochs and I will have to add code to introduce epochs into my train function?

1 Answers1

1

An epoch is completed when you have passed through the whole dataset, or all of the batches. Most complex models such as deep neural networks require multiple epochs to perform well.

In your case if your model requires multiple passes through the training dataset before its performance stabilizes, then you should add code within your optuna objective function to perform multiple epochs during a trial. A trial is a single call to your objective function, which should return an evaluation of the model. The purpose of a trial is to assess a set of hyperparameters, and this assessment will be misleading if the model is not trained for enough epochs before it is evaluated.

Vityou
  • 152
  • 1
  • 11