How to execute some python code after a certain period in keras… here is a solution to the problem.
How to execute some python code after a certain period in keras
My simple code works fine, but I need to create something like 1% ML completion and 10% ML completion etc….
trainX = np.array(features_data)
trainY = np.array(labels_data)
model = Sequential()
model.add(Dense(10, input_dim=input_dimensions, activation='relu'))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(trainX, trainY, nb_epoch=3000, batch_size=2, verbose=2)
model.save(model_location)
Or how to execute some python code after epoch executes?
Epoch 1707/3000
0s - loss: 0.5908
Epoch 1708/3000
0s - loss: 0.4808
Epoch 1709/3000
how to execute here some code on python
0s - loss: 0.7568
Epoch 1710/3000
0s - loss: 0.5906
Solution
You are looking for Callback
on_epoch_end
Executed after each epoch. The documentation may show you different scenarios that you can achieve using their APIs
.