ML.PREPROCESSING.MIN_MAX_SCALER¶
Scales each feature to a given range, usually between 0 and 1.
Syntax¶
Returns¶
A MinMaxScaler transformer handle, ready to pass into ML.FIT_TRANSFORM or ML.PIPELINE.
When to use¶
Use min_max_scaler when a downstream model or visualization needs values
strictly inside [0, 1]. Each feature is rescaled so the smallest value
seen during fit becomes 0 and the largest becomes 1, with everything
else linearly between.
Compared to the alternatives in this namespace:
- Use
ML.PREPROCESSING.STANDARD_SCALERas the default for most ML workflows — it handles algorithms that assume zero-centered features. - Use min_max_scaler when you need bounded outputs (e.g. for image
pixel-style features or models that explicitly expect
[0, 1]inputs). - Use
ML.PREPROCESSING.ROBUST_SCALERwhen your data has outliers that would stretch the min-max range.
Examples¶
Rescale each column of A2:E100 to the [0, 1] range:
Wrap the scaler and a model in a pipeline so the same scaling is applied at predict time:
=ML.PREPROCESSING.MIN_MAX_SCALER()
=ML.CLASSIFICATION.LOGISTIC()
=ML.PIPELINE(H1, H2)
=ML.FIT(H3, A2:E100, F2:F100)
=ML.PREDICT(H4, A101:E110)
Remarks¶
- Outliers in the training data set the bounds. A single extreme row makes
every other value cluster near
0or1— switch toML.PREPROCESSING.ROBUST_SCALERif outliers are common. - Always fit on the training data only, then
ML.TRANSFORMthe test data through the same fitted scaler. Test rows outside the original min/max will simply fall outside[0, 1]— that is expected behavior.