Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation_data and Validation_split

So I have a GRU model that predict output power. For the training data I have a csv file which has data from 2018, while for my testting data it is a different csv file which has data from 2019.

I just had to short questions.

  1. Since I'm using 2 different csv files one for testing and one for training, I do not need to train_test_split?

  2. When it comes to model.fit, I really don't know the difference between Validation_data and Validation_split and which one should I use?

I have tested these 3 lines seperately, the 2nd and 3rd line give me the same exact results , while the first gives me way lower val_loss.

Thank you.

history=model.fit(X_train, y_train, batch_size=256, epochs=25, validation_split=0.1, verbose=1, callbacks=[TensorBoardColabCallback(tbc)])  
history=model.fit(X_train, y_train, batch_size=256, epochs=25, validation_data=(X_test, y_test), verbose=1, callbacks=[TensorBoardColabCallback(tbc)])
history=model.fit(X_train, y_train, batch_size=256, epochs=25, validation_data=(X_test, y_test), validation_split=0.1, verbose=1, callbacks=[TensorBoardColabCallback(tbc)])
like image 297
Ali Youssef Avatar asked May 11 '26 23:05

Ali Youssef


1 Answers

  1. You can do what you want, yes you can use one file to train and one to validate. But you could also merge them then use train_test_split if you wish. However, I would recommend you to merge them as you have data from different periods of time, there may be differences.
  2. Using validation_data means you are providing the training set and validation set yourself, whereas using validation_split means you only provide a training set and keras splits it into a training set and a validation set (with the validation set being validation_split times the size of the training set)
like image 91
Thomas Schillaci Avatar answered May 14 '26 13:05

Thomas Schillaci