Session Ready
Exercise

The history callback

The history callback is returned by default every time you train a model with the .fit() method. To access these metrics you can access the history dictionary parameter inside the returned h_callback object with the corresponding keys.

The irrigation machine model you built in the previous lesson is loaded for you to train, along with its features and labels now loaded as X_train, y_train, X_test, y_test. This time you will store the model's historycallback and use the validation_data parameter as it trains.

You will plot the results stored in history with plot_accuracy() and plot_loss(), two simple matplotlib functions. You can check their code in the console by pasting show_code(plot_loss).

Let's see the behind the scenes of our training!

Instructions
100 XP
  • Train your model on X_train and y_train, validate each epoch on X_test and y_test.
  • Use plot_lossextracting lossand val_loss from h_callback.
  • Use plot_accuracyextracting accand val_acc from h_callback.