Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

Visualizing Loss vs Epochs

Now that we have built the model, let us visualize how the model loss varies with respect to the epoch for the train data and validation data using matplotlib.

  • Firstly, let us have a look at the history, where all the history about various parameters like loss, mean_squared_error, and validation mean_squared_error are stored when the model was fit on train data and validated on validation data.

  • Since we aim to plot the training loss an validation loss behavior with respect to the number of epochs, let us use those corresponding values from history.history dictionary.

    loss represents the training loss and val_loss indicates the validation loss.

    Let us plot the training loss and validation loss. We shall also set the title, ylabel, xlabel, and legend for the plot and finally show it.

    plt.plot(history.history['loss'])  # plotting train loss
    plt.plot(<< your code comes here >>)  # plotting validation loss
    plt.title('model loss')
    plt.legend(['train', 'val'], loc='upper left')

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...