Scaling features to a range
Feature scaling is a preprocessing technique in machine learning that rescales the range of independent variables or features of a dataset. It’s used to ensure that all features contribute equally to the model training process by bringing them to a common scale. Feature scaling is particularly important for algorithms that are sensitive to the scale of input features, such as k-nearest neighbors and gradient descent-based optimization algorithms.
Note
When scaling features, we’re changing the range of the distribution of the data.
Let’s present an example to make the concept of feature scaling easier to grasp. Let’s suppose you’re working on a machine learning project to predict housing prices based on various features of the houses, such as the following:
- Square footage (in square feet)
- Distance to the nearest school (in miles)
- Distance to the nearest public transportation stop (miles)
Now...