What is Feature Scaling?
G Muralidhar
?GenAI Specialist ?AI & Business Strategist ?Productivity Coach ? 20+ years Experience
Feature scaling is a technique in machine learning where we adjust the values of different features (or columns) in our dataset to bring them to a common scale. This ensures that no single feature dominates others due to its larger magnitude.
Why Do We Need Feature Scaling?
Imagine you're predicting the price of a house. Your dataset has features like:
1.??? Square footage (ranging from 1000 to 4000).
2.??? Number of bedrooms (ranging from 1 to 5).
Because the range of square footage is much larger than the number of bedrooms, the machine learning model might think square footage is more important, even when both features are equally significant. Feature scaling prevents such bias.
How Feature Scaling Helps
1.??? Improves Model Performance:
Many algorithms, like Gradient Descent (used in Linear Regression) and Support Vector Machines (SVM), perform better when features are scaled.
2.??? Prevents Bias in Distance-Based Models:
Algorithms like K-Nearest Neighbors (KNN) and K-Means Clustering calculate distances. Without scaling, larger values dominate the distance calculations.
3.??? Makes Training Faster:
Scaling speeds up the convergence of optimization algorithms.
Summary
Normalization: Rescales values to a fixed range, usually 0 to 1.
Standardization: Centres data around 0 with a standard deviation of 1.
Used to ensure that no single feature disproportionately influences the model.
Exercise
1.?Why do we need feature scaling in machine learning? Provide an example.
2. What is the difference between normalization and standardization? When would you use each?
3. Normalize the following data using min-max scaling: [50, 100, 150], where the minimum is 50 and the maximum is 150. Show your work.
Note:
World's first simplest and easiest explanation of AI and Machine Learning. Many resources are too technical, limiting their reach. If this article makes machine learning easier to understand, please share it with others who might benefit. Your likes and shares help spread these insights. Thank you for reading!