Skip to content
Lambdian

Feature scaling (standardisation)

Rescaling features to comparable ranges, usually mean 0 and standard deviation 1.

Standardisation maps each feature to z=(x−μ)/σz = (x - \mu)/\sigma. Many algorithms need it: k-NN, k-means, SVMs and PCA use distances or variances that a large-unit feature would dominate, and gradient descent converges far faster on scaled features. Ridge and lasso penalise weights equally only when features share a scale.

Tree-based models (decision trees, random forests, boosting) do not need scaling. Always fit the scaler on the training split and reuse it on validation and test data.

See it in action