1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with Keras

Exercise

Do we need more data?

It's time to check whether the digits dataset model you built benefits from more training examples!

In order to keep code to a minimum, various things are already initialized and ready to use:

  • The model you just built.
  • X_train,y_train,X_test, and y_test.
  • The initial_weights of your model, saved after using model.get_weights().
  • A pre-defined list of training sizes: training_sizes.
  • A pre-defined early stopping callback monitoring loss: early_stop.
  • Two empty lists to store the evaluation results: train_accs and test_accs.

Train your model on the different training sizes and evaluate the results on X_test. End by plotting the results with plot_results().

The full code for this exercise can be found on the slides!

Instructions

100 XP
  • Get a fraction of the training data determined by the size we are currently evaluating in the loop.
  • Set the model weights to the initial_weights with set_weights() and train your model on the fraction of training data using early_stop as a callback.
  • Evaluate and store the accuracy for the training fraction and the test set.
  • Call plot_results() passing in the training and test accuracies for each training size.