Normalization and Standardization
Feature scaling helps ensure that no feature dominates others during modeling. Normalization and Standardization are widely used feature scaling techniques. Normalization typically scales features in the range [0, 1] ensuring they have roughly the same scale. Standardization transforms the data to have zero mean and unit variance, maintaining more information about outliers and not bounding the range. matplotlib.pyplot
has been imported as plt
, MinMaxScaler
and StandardScaler
have been imported, and the split heart disease data features have been imported as X_train
and X_test
.
This exercise is part of the course
End-to-End Machine Learning
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Show the initial distribution of 'age'
age = ____
plt.figure(figsize=(10,5))
plt.hist(____, bins=30, alpha=0.5, label='Original')
plt.legend(prop={'size': 16})
plt.title('Histogram with Original Age');
plt.xlabel('Age'); plt.ylabel('Count');
plt.show()