Feature scaling

term_id: feature_scaling

Category: basic_concepts

Definition

Feature scaling standardizes the range of input variables to prevent features with larger magnitudes from dominating the learning process. Common methods include normalization (min-max scaling) and standardization (z-score scaling). This step is crucial for algorithms sensitive to the scale of input data, such as gradient descent-based optimizers, support vector machines, and k-nearest neighbors, ensuring faster convergence and more stable model training.

Summary

The process of normalizing the range of independent variables or features of data to ensure uniformity in magnitude.

Key Concepts

  • Normalization
  • Standardization
  • Gradient descent
  • Data preprocessing

Use Cases

  • Training neural networks
  • K-means clustering
  • Support Vector Machines (SVM)

Code Example

1
2
3
4
5
6
7
from sklearn.preprocessing import StandardScaler
import numpy as np

X = np.array([[1, 2], [3, 4], [5, 6]])
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
print(X_scaled)