Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Permalink
Browse files

DOC More details about the attributes in MinMaxScaler (#13029)

  • Loading branch information
qinhanmin2014 authored and jnothman committed Jan 30, 2019
1 parent 5fc5c6e commit 31cef3b8f27152272ac807d5f3aefb088c9d8d10
Showing with 15 additions and 3 deletions.
  1. +15 −3 sklearn/preprocessing/data.py
@@ -210,6 +210,11 @@ class MinMaxScaler(BaseEstimator, TransformerMixin):
where min, max = feature_range.
The transformation is calculated as::
X_scaled = scale * X + min - X.min(axis=0) * scale
where scale = (max - min) / (X.max(axis=0) - X.min(axis=0))
This transformation is often used as an alternative to zero mean,
unit variance scaling.
@@ -227,10 +232,12 @@ class MinMaxScaler(BaseEstimator, TransformerMixin):
Attributes
----------
min_ : ndarray, shape (n_features,)
Per feature adjustment for minimum.
Per feature adjustment for minimum. Equivalent to
``min - X.min(axis=0) * self.scale_``
scale_ : ndarray, shape (n_features,)
Per feature relative scaling of the data.
Per feature relative scaling of the data. Equivalent to
``(max - min) / (X.max(axis=0) - X.min(axis=0))``
.. versionadded:: 0.17
*scale_* attribute.
@@ -409,12 +416,17 @@ def minmax_scale(X, feature_range=(0, 1), axis=0, copy=True):
that it is in the given range on the training set, i.e. between
zero and one.
The transformation is given by::
The transformation is given by (when ``axis=0``)::
X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0))
X_scaled = X_std * (max - min) + min
where min, max = feature_range.
The transformation is calculated as (when ``axis=0``)::
X_scaled = scale * X + min - X.min(axis=0) * scale
where scale = (max - min) / (X.max(axis=0) - X.min(axis=0))
This transformation is often used as an alternative to zero mean,
unit variance scaling.

0 comments on commit 31cef3b

Please sign in to comment.
You can’t perform that action at this time.