Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the relation between validation_data and validation_split in Keras' fit function?

validation_split says: "hey give me all the input data – I will take care of splitting between test and validation".

model.fit(inputX, inputY, validation_split=0.20, epochs=10, batch_size=10)

validation_data says "please give me explicitly the validation data"

model.fit(inputX, inputY, validation_data=(testX,testY), epochs=10, batch_size=10)

Is there any hidden trick or something I am missing apart from my understanding?

like image 776
DrunkenMaster Avatar asked Jul 15 '17 10:07

DrunkenMaster


People also ask

What is Validation_split in model fit?

validation_split: Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch.

What does Validation_split mean?

validation_split is a parameter that gets passed in. It's a number that determines how your data should be partitioned into training and validation sets. For example if validation_split = 0.1 then 10% of your data will be used in the validation set and 90% of your data will be used in the test set.

How do you split training and testing data in keras?

Keras can separate a portion of your training data into a validation dataset and evaluate the performance of your model on that validation dataset in each epoch. You can do this by setting the validation_split argument on the fit() function to a percentage of the size of your training dataset.


2 Answers

No, everything is correct. One potential reason behind this separation is that sometimes people have training and validation data separately (in many academic datasets) and sometimes you have all the data and can split it anyway you want.

like image 163
Salvador Dali Avatar answered Oct 14 '22 06:10

Salvador Dali


Your understanding is correct. To add more details - validation_split keras function makes easy for the user to split the training dataset into train and validation (saving your custom efforts).

For example - setting validation_split=0.2, tells keras to use last 20% of the data before shuffling for validation.

like image 45
mental_matrix Avatar answered Oct 14 '22 06:10

mental_matrix