Standardization rescales a feature so that its values have a mean of 0 and a standard deviation of 1. For each value, subtract the feature’s mean and divide by its standard deviation. The result, often called a z-score, says how many standard deviations a value sits above or below average. Scikit-learn’s StandardScaler does exactly this.
Why bother
Raw features arrive in whatever units they were recorded in. Income might run into the hundreds of thousands while age tops out near 100. Many methods are sensitive to that. A distance-based method or an RBF-kernel SVM will be dominated by the feature with the biggest numbers. Penalties like L2 regularization treat all weights alike, which only makes sense if the features share a scale. And gradient descent tends to converge faster when inputs are centred near zero and have similar variances, a point LeCun and colleagues made in their 1998 guide to training neural networks.
Tree-based models are the notable exception: a decision tree splits on thresholds, so rescaling a feature doesn’t change what it learns.
Standardization vs. normalization
The two words are often used loosely. Strictly, standardization centres and scales by the standard deviation, while min-max normalization squeezes values into a fixed range such as 0 to 1. Standardization has no fixed range, and extreme outliers still distort the mean and standard deviation it relies on, so robust scalers based on the median are used for heavy-tailed data.
The common mistake
Compute the mean and standard deviation on the training set only, then apply those same numbers to the validation and test sets. Computing them on the full dataset first lets information about the test data into training, a quiet form of data leakage.