ctiid
ctiid

Reputation: 365

keras model.fit with validation data - which batch_size is used to evaluate the validation data?

I want to validate my model with validation data inside

model.fit(x_train, y_train, batch_size= 50, epochs=1,validation_data=(x_test,y_test))

Now, I want to train with batch_size=50. My validation data x_test is like of length of 1000. As I can read from the doc the validation data is used after each epoch to evaluate. So I assume the model.evaluate method is used? But what batch size is used?

My validation data is greater then the batch_size in the fit method.

How is this handled?

What are the result if just the training batch_size is used but validation data is larger? Is val_acc averaged over each batch?

I want to validate on all my data in one batch.

Upvotes: 9

Views: 22203

Answers (1)

Anakin
Anakin

Reputation: 2010

Keras uses the same batch_size parameter for both training and validation in model.fit(). See discussion here.

If you intend to do evaluate on the entire validation data, you can maybe write a callback function and run model.evaluate() on the entire validation data after every epoch.

Upvotes: 8

Related Questions