@@ -210,6 +210,11 @@ class MinMaxScaler(BaseEstimator, TransformerMixin):
210
210
211
211
where min, max = feature_range.
212
212
213
+ The transformation is calculated as::
214
+
215
+ X_scaled = scale * X + min - X.min(axis=0) * scale
216
+ where scale = (max - min) / (X.max(axis=0) - X.min(axis=0))
217
+
213
218
This transformation is often used as an alternative to zero mean,
214
219
unit variance scaling.
215
220
@@ -227,10 +232,12 @@ class MinMaxScaler(BaseEstimator, TransformerMixin):
227
232
Attributes
228
233
----------
229
234
min_ : ndarray, shape (n_features,)
230
- Per feature adjustment for minimum.
235
+ Per feature adjustment for minimum. Equivalent to
236
+ ``min - X.min(axis=0) * self.scale_``
231
237
232
238
scale_ : ndarray, shape (n_features,)
233
- Per feature relative scaling of the data.
239
+ Per feature relative scaling of the data. Equivalent to
240
+ ``(max - min) / (X.max(axis=0) - X.min(axis=0))``
234
241
235
242
.. versionadded:: 0.17
236
243
*scale_* attribute.
@@ -409,12 +416,17 @@ def minmax_scale(X, feature_range=(0, 1), axis=0, copy=True):
409
416
that it is in the given range on the training set, i.e. between
410
417
zero and one.
411
418
412
- The transformation is given by::
419
+ The transformation is given by (when ``axis=0``) ::
413
420
414
421
X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0))
415
422
X_scaled = X_std * (max - min) + min
416
423
417
424
where min, max = feature_range.
425
+
426
+ The transformation is calculated as (when ``axis=0``)::
427
+
428
+ X_scaled = scale * X + min - X.min(axis=0) * scale
429
+ where scale = (max - min) / (X.max(axis=0) - X.min(axis=0))
418
430
419
431
This transformation is often used as an alternative to zero mean,
420
432
unit variance scaling.
0 commit comments