I have been saving my training history in keras as follows:
history = model.fit(X_train, Y_train, epochs=700, batch_size=128,validation_data=(X_cv, Y_cv))
np.save('./history_sim#', history)
I am then trying to load the training history from the various simulations in order to print figures like loss vs. epoch, etc. as follows:
history = np.load('history_sim#.npy')
When I try to load the training history, I am receiving the following error message:
"ValueError: Unknown metric function:precision"
I am very worried that I have lost all of the training history now. Training takes several days and I am on a bit of a time crunch. Is the data lost or is there some way to get the data from the .npy file where I have saved it?
I already figured out that it works perfectly if I save/load as follows:
np.save('./history_sim#', history.history)
np.load('history_sim#').item()
I will do that for the rest of the simulations, but there are already a few that were saved the first way and I do not have time to re-run them.
Thanks!
Additional Info:
import keras_metrics
# Calculate precision for the second label.
precision = keras_metrics.precision(label=1)
# Calculate recall for the first label.
recall = keras_metrics.recall(label=0)
opt = Adam(lr=0.05, beta_1=0.9, beta_2=0.999, decay=0.0)
model.compile(loss='binary_crossentropy', optimizer=opt, metrics=[precision, recall])