Two Ways to Align Different Scales
Pixels may range from 0 to 255, ages span tens, and incomes can reach millions. For methods driven by distances or gradients, a large numerical scale can give one feature disproportionate influence. Two common remedies are min-max normalization and z-score standardization.
- Min-max normalization: . It maps the training data's minimum and maximum to 0 and 1.
- Z-score standardization: . It gives the training data mean 0 and standard deviation 1.
Neither Operation Changes the Distribution's Shape
Both are affine transformations: they shift values and divide by a positive constant. A right-skewed distribution remains right-skewed, and a bimodal distribution remains bimodal. Z-score standardization does not turn arbitrary data into a standard normal distribution; it only matches that distribution's mean and standard deviation.
Min-max values can fall below 0 or above 1 when new observations lie outside the training range. Z-scores are unbounded from the start, and both methods are sensitive to outliers. For severe outliers, a robust scaler based on the median and interquartile range may be a better fit.
Prevent Data Leakage
Compute minima, maxima, means, and standard deviations on the training set only, then reuse those values for validation and test data. Fitting the scaler on the full dataset leaks evaluation-distribution information into the training pipeline.
Scaling Is Model-Dependent
Neural networks, k-nearest neighbors, SVMs, and linear models often benefit from aligned feature scales. Decision-tree families are comparatively insensitive to monotonic rescaling because they split on per-feature thresholds. Choose the transformation for the model and data-generating process.
min-max 정규화 시, 보장된 범위 [0,1]를 얻음 - 압축 z-scoree 표준화 시, 보장된 평균(0)을 얻음 - 모양