I'm trying to train a model with the following code in Colab, using keras:
model.fit(
x_tr, y_tr,
batch_size = 1,
callbacks=[model_checkpoint_callback],
validation_data = (x_val, y_val),
epochs = num_training)
The point is that using Colab it says that there are problem with the RAM so what I want to do is split the dataset (x_tr), and train the model on the different splits like this:
num_divisione_dataset=8
div_tr = int(16640/num_divisione_dataset)
div_val = int(2160/num_divisione_dataset)
num_training = int(math.ceil(100/num_divisione_dataset))
for i in range(0,num_divisione_dataset-1):
print("Training number: \n\n ", num_divisione_dataset)
model.fit(
x_tr[div_tr*i:div_tr*(i+1)], y_tr[div_tr*i:div_tr*(i+1)],
batch_size = 1,
callbacks=[model_checkpoint_callback],
validation_data = (x_val[div_val*i:div_val*(i+1)], y_val[div_val*i:div_val*(i+1)]),
epochs = num_training)
So what I'm doing is taking each split (8 splits in total) of x_tr and training the model till the final split.
For each split I'm training for 13 epochs.
Is it the right way to train the model on the whole dataset? The point is that when I try to predict using the model I have the 20% of accuracy, against the 96% on the evaluation set.