Plotting learning curve in keras gives KeyError: 'val_acc'

前端 未结 8 2019
情话喂你
情话喂你 2020-12-09 09:54

I was trying to plot train and test learning curve in keras, however, the following code produces KeyError: \'val_acc error.

The official document

相关标签:
8条回答
  • 2020-12-09 10:51

    I have changed acc to accuracy and my problem solved. Tensorflow 2+

    e.g.

    accuracy = history_dict['accuracy']
    val_accuracy = history_dict['val_acccuracy']
    
    0 讨论(0)
  • to get any val_* data (val_acc, val_loss, ...), you need to first set the validation.

    first method (will validate from what you give it):

    model.fit(validation_data=(X_test, Y_test))
    

    second method (will validate from a part of the training data):

    model.fit(validation_split=0.5) 
    
    0 讨论(0)
提交回复
热议问题