1
votes

I am training a tensorflow DNN model which gives results like this,

    Epoch 1/60
119/119 [==============================] - 273s 2s/step - loss: 1.4571 - accuracy: 0.3004 - val_loss: 1.3791 - val_accuracy: 0.2999
Epoch 2/60
119/119 [==============================] - 281s 2s/step - loss: 1.3186 - accuracy: 0.3503 - val_loss: 1.3658 - val_accuracy: 0.3193
Epoch 3/60
119/119 [==============================] - 274s 2s/step - loss: 1.2985 - accuracy: 0.3703 - val_loss: 1.3475 - val_accuracy: 0.2962
Epoch 4/60
119/119 [==============================] - 271s 2s/step - loss: 1.2885 - accuracy: 0.3829 - val_loss: 1.3258 - val_accuracy: 0.3162

Can I generate a dataframe having epochs, loss, accuracy, val_accuracy and val_loss ?

like

epochs  loss     accuracy  val_loss  val_accuracy
1       1.4571   0.3004    1.3791    0.2999
2       1.3186   0.3503    1.3658    0.3193
3       1.2985   0.3703    1.3475    0.2962
4       1.2885   0.3829    1.3258    0.3162
1

1 Answers

1
votes

As described here, you can do it by saving the history from model.fit in a variable and then creating your DataFrame using that, as such:

history = model.fit(x_train, y_train, epochs=10)
   
hist_df = pd.DataFrame(history.history)