How to interpret Keras model.fit output?

后端 未结 2 1735
灰色年华
灰色年华 2020-12-15 18:01

I\'ve just started using Keras. The sample I\'m working on has a model and the following snippet is used to run the model

from sklearn.preprocessing import          


        
相关标签:
2条回答
  • 2020-12-15 18:51

    ETA = Estimated Time of Arrival.

    80 is the size of your training set, 32/80 and 64/80 mean that your batch size is 32 and currently the first batch (or the second batch respectively) is being processed.

    loss and acc refer to the current loss and accuracy of the training set. At the end of each epoch your trained NN is evaluated against your validation set. This is what val_loss and val_acc refer to.

    The history object returned by model.fit() is a simple class with some fields, e.g. a reference to the model, a params dict and, most importantly, a history dict. It stores the values of loss and acc (or any other used metric) at the end of each epoch. For 2 epochs it will look like this:

    {
        'val_loss': [16.11809539794922, 14.12947562917035],
        'val_acc': [0.0, 0.0],
        'loss': [14.890108108520508, 12.088571548461914],
        'acc': [0.0, 0.25]
    }
    

    This comes in very handy if you want to visualize your training progress.

    Note: if your validation loss/accuracy starts increasing while your training loss/accuracy is still decreasing, this is an indicator of overfitting.

    Note 2: at the very end you should test your NN against some test set that is different from you training set and validation set and thus has never been touched during the training process.

    0 讨论(0)
  • 2020-12-15 18:52

    32 is your batch size. 32 is the default value that you can change in your fit function if you wish to do so.

    After the first batch is trained Keras estimates the training duration (ETA: estimated time of arrival) of one epoch which is equivalent to one round of training with all your samples.

    In addition to that you get the losses (the difference between prediction and true labels) and your metric (in your case the accuracy) for both the training and the validation samples.

    0 讨论(0)
提交回复
热议问题