Imagine you're making a dessert and following a recipe that lists ingredients in different units—some in grams, some in tablespoons. Now, you want to ensure each ingredient plays a fair role in the final dish. If you don't scale them properly, one ingredient might overpower the others because it's measured in larger units. Let's say you unintentionally put a lot of cocoa powder in your dessert than the actual amount required so your dessert now tastes bitter. We don't want it right?
In the world of data and machine learning, our "ingredients" are features or variables in a dataset. Feature scaling is like ensuring each of these "ingredients" gets a fair portion in the analysis so that we don't end up with a dessert that tastes too bitter, or we can say end up making a wrong model. We want to avoid letting one feature overshadow others just because it's naturally on a different scale.
Common methods for feature scaling include:
- Min-Max Scaling (Normalization)
- standardization (Z-score normalization)
(these methods are applied column-wise, which means we will normalize all the values of one column, we won't be doing it row-wise)
Let's understand with an example:
Think, we have a dataset that contains age and salary.
The differences in values of salaries are way bigger than the differences in values of ages, we can't put them in the same position. On one side the difference is 10K another side we have 1. Now if I want to group them I would surely group red and purple together as their difference is 8k; 2k lesser than blue and purple. But it may give us wrong ans. So we have to bring them down to a position where we can compare them. If Normalizing is used we'll get-
Now, you can easily say that the purple person is closer to the blue person. And we would group blue and purple.
Top comments (0)