During instantiation of a GluonTS trainer, one can specify both batch_size and num_batches_per_epoch at the same time.
However,
num_batches_per_epoch = num_samples /batch_size
Since num_samples is taken from the training dataset directly, how can one specify both arguments at the same time?
Is it like we can specify one of these two arguments and the other one is calculated automatically? If that is the case, when we specify both, which one has the priority?
@ChaiBapchya the point is exactly that of breaking the relationship that you expressed, and allow for finer control of how long training should be.
The reason for this is the following: in many of the estimators, batches are formed by slicing out randomly sampled windows of data from the original dataset entries. Therefore, what you identify as num_samples can be much larger than the cardinality of the training dataset: in that case, even running 1 ”full epoch“ may take very long time. By explicitly setting how long an epoch should be, one has everything under control and knows exactly how many batches the training procedure will get to see.
It makes sense. I think it might be good to have this information in the code.
In addition to that, does that mean by default we are only using 32 (batch_size) * 50 (num_batches_per_epoch) data points in one epoch no matter how many data samples are given in the training dataset?
Do you think it might easier to understand if we set the default value of num_batches_per_epoch to be none (meaning it will be inferred by num_samples/batch_size), and if specified, we can still control the full epoch size?
Most helpful comment
@ChaiBapchya the point is exactly that of breaking the relationship that you expressed, and allow for finer control of how long training should be.
The reason for this is the following: in many of the estimators, batches are formed by slicing out randomly sampled windows of data from the original dataset entries. Therefore, what you identify as
num_samplescan be much larger than the cardinality of the training dataset: in that case, even running 1 ”full epoch“ may take very long time. By explicitly setting how long an epoch should be, one has everything under control and knows exactly how many batches the training procedure will get to see.