- Apache Spark Deep Learning Cookbook
- Ahmed Sherif Amrith Ravindra
- 83字
- 2025-02-26 11:49:45
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.mean(axis=0))/X.std(axis=0)
return X