14 Baby steps with deep learning

 

This chapter covers

  • Implementing linear models
  • Enacting deep neural networks

In the last chapter, we implemented the DataWindow class, which allows us to quickly create windows of data for building single-step models, multi-step models, and multi-output models. With this crucial component in place, we then developed the baseline models that will serve as benchmarks for our more complex models, which we’ll start building in this chapter.

Specifically, we’ll implement linear models and deep neural networks. A linear model is a special case of a neural network, where there is no hidden layer. This model simply calculates weights for each input variable in order to output a prediction for the target. In contrast, a deep neural network has at least one hidden layer, allowing us to start modeling nonlinear relationships between the features and the target, usually resulting in better forecasts.

In this chapter, we’ll continue the work we started in chapter 13. I recommend that you continue coding in the same notebook or Python scripts as in the last chapter, so that you can compare the performance of these linear models and deep neural networks to that of the baseline models from chapter 13. We’ll also keep working with the same dataset as previously, and our target variable will remain the traffic volume for both the single-step and multi-step models. For the multi-output model, we’ll keep the temperature and traffic volume as our targets.

14.1 Implementing a linear model

14.1.1 Implementing a single-step linear model

14.1.2 Implementing a multi-step linear model

14.1.3 Implementing a multi-output linear model

14.2 Implementing a deep neural network

14.2.1 Implementing a deep neural network as a single-step model

14.2.2 Implementing a deep neural network as a multi-step model

14.2.3 Implementing a deep neural network as a multi-output model

14.3 Next steps

14.4 Exercises

Summary