Normalizing the input data for the neural network
Neural networks work more efficiently when the inputs are normalized. This minimizes the magnitude of a particular input affecting the overall outcome over other potential inputs that have lower values of magnitude. This section will normalize the height
and weight
inputs of the current individuals.
Getting ready
The normalization of input values requires obtaining the mean and standard deviation of those values for the final calculation.
How to do it...
This section walks through the steps to normalize the height and weight.
- Slice the array into inputs and outputs using the following script:
X = data_array[:,:2] y = data_array[:,2]
- The mean and the standard deviation can be calculated across the 29 individuals using the following script:
x_mean = X.mean(axis=0) x_std = X.std(axis=0)
- Create a normalization function to normalize
X
using the following script:
def normalize(X): x_mean = X.mean(axis=0) x_std = X.std(axis=0) X = (X - X...