nayash / stock_cnn_blog_pub

This project is a loose implementation of paper "Algorithmic Financial Trading with Deep Convolutional Neural Networks: Time Series to Image Conversion Approach"
Apache License 2.0
165 stars 95 forks source link

Early stopping conditioned on metric `val_loss` which is not available #3

Open HypergeneticSpacekid opened 4 years ago

HypergeneticSpacekid commented 4 years ago

Hi,

I am getting the following errors, when executing

history = model.fit(x_train, y_train, epochs=params['epochs'], verbose=0,
                    batch_size=64, shuffle=True,
                    validation_data=(x_cv, y_cv),
                    callbacks=[es, mcp, rlp]
                    , sample_weight=sample_weights)

returns:

"WARNING:tensorflow:Early stopping conditioned on metric val_loss which is not available. Available metrics are: WARNING:tensorflow:Can save best model only with val_loss available, skipping. WARNING:tensorflow:Reduce LR on plateau conditioned on metric val_loss which is not available. Available metrics are: lr"

Do you know why this might be happening?

best wishes and thanks, Alex

nayash commented 4 years ago

I never faced this warning while training. Also, I have not used Keras in a while now, so hard to say (without looking at rest of the code) what's happening here. But you may wanna look at this.

via986 commented 3 years ago

@HypergeneticSpacekid i got almost same error in mcp, solved:

replaced this line:

mcp = ModelCheckpoint(best_model_path, monitor='val_f1_metric', verbose=1, save_best_only=True, save_weights_only=False, mode='max', period=1)

to:

mcp = ModelCheckpoint(best_model_path, monitor='val_f1_metric', verbose=1, save_best_only=True, save_weights_only=False, mode='max', save_freq="epoch")