6 Training the model and running experiments

 

This chapter covers

  • Viewing the end-to-end training process
  • Selecting subsets of the dataset for training, validation, and testing
  • Doing an initial training run
  • Measuring the performance of your model
  • Optimizing your training time by exploiting Keras’ early stopping feature
  • Shortcuts to scoring
  • Saving trained models
  • Running a series of training experiments to improve model performance

So far in this book, we have prepared the data and examined the code that makes up the model itself. Now we are finally ready to train the model. We’ll review some of the basics, including selecting the training, test, and validation dataset. Then we’ll go through an initial training run to validate that the code functions without errors and will cover the critical topic of monitoring your model’s performance. Next, we’ll show how to take advantage of the early stopping facility in Keras to get maximum benefit from your training runs. After that, we will go over how you can use your trained model to score a new record before you have the model fully deployed. Finally, we will run a series of experiments to improve the performance of the deep learning model.

6.1 Code for training the deep learning model

When you have cloned the GitHub repo (http://mng.bz/v95x) associated with this book, you’ll find the code related to training the model in the notebooks sub-directory. The following listing shows the files that contain the code described in this chapter.

6.2 Reviewing the process of training a deep learning model

6.3 Reviewing the overall goal of the streetcar delay prediction model

6.4 Selecting the train, validation, and test datasets

6.5 Initial training run

6.6 Measuring the performance of your model

6.7 Keras callbacks: Getting the best out of your training runs

6.8 Getting identical results from multiple training runs