Training a neural network for regression
A perceptron is not a powerful and commonly used machine learning model. But having many perceptrons employed together in a neural network can become a powerful machine learning model. In this recipe, we will review a simple neural network, sometimes called a multi-layer perceptron or vanilla neural network. And we will then train such a neural network on a regression task on the California housing dataset with PyTorch, a widely used framework in deep learning.
Getting started
Let’s start by reviewing what a neural network is, and how to feed forward a neural network from input features.
A neural network can be divided into three parts:
- The input layer, containing the input features
- The hidden layers, which can be any number of layers and units
- The output layer, which is defined by the expected output of the neural network
In both the hidden and output layers, we consider each unit (or neuron) to be a perceptron...