If I understand correctly that batch size is the number of samples used in the training of a NN before the gradient gets updated, then why do we need a specified batch_size for the validation sample?

The problem that led me to have this question is this: If I give a large batch_size, then the first couple of validation events are used repeatedly, instead of the validation iterating over the whole validation sample.

My question is about Keras and Sequential, but there is a chance that it applies more generally.


1 Answer 1


It means that the validation data will be drawn by batches. There may be cases when you can’t put the whole validation dataset at once in your neural net, you do it in minibatch, similarly as you do for training.

  • $\begingroup$ Thanks! But in this case does the batch size change the result of the validation? (Sorry, I still try to understand its role in the big scheme of things.) $\endgroup$
    – Helen
    Apr 14, 2020 at 18:52
  • 5
    $\begingroup$ Since validation set is a proxy for test set, it doesn't change the valdiation results. Think the validation batch size as a memory trick $\endgroup$ Apr 14, 2020 at 20:48

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.