class sklearn.preprocessing.MaxAbsScaler(copy=True)
[source]
Scale each feature by its maximum absolute value.
This estimator scales and translates each feature individually such that the maximal absolute value of each feature in the training set will be 1.0. It does not shift/center the data, and thus does not destroy any sparsity.
This scaler can also be applied to sparse CSR or CSC matrices.
New in version 0.17.
Parameters: |
|
---|---|
Attributes: |
|
See also
maxabs_scale
NaNs are treated as missing values: disregarded in fit, and maintained in transform.
For a comparison of the different scalers, transformers, and normalizers, see examples/preprocessing/plot_all_scaling.py.
>>> from sklearn.preprocessing import MaxAbsScaler >>> X = [[ 1., -1., 2.], ... [ 2., 0., 0.], ... [ 0., 1., -1.]] >>> transformer = MaxAbsScaler().fit(X) >>> transformer MaxAbsScaler(copy=True) >>> transformer.transform(X) array([[ 0.5, -1. , 1. ], [ 1. , 0. , 0. ], [ 0. , 1. , -0.5]])
fit (X[, y]) | Compute the maximum absolute value to be used for later scaling. |
fit_transform (X[, y]) | Fit to data, then transform it. |
get_params ([deep]) | Get parameters for this estimator. |
inverse_transform (X) | Scale back the data to the original representation |
partial_fit (X[, y]) | Online computation of max absolute value of X for later scaling. |
set_params (**params) | Set the parameters of this estimator. |
transform (X) | Scale the data |
__init__(copy=True)
[source]
fit(X, y=None)
[source]
Compute the maximum absolute value to be used for later scaling.
Parameters: |
|
---|
fit_transform(X, y=None, **fit_params)
[source]
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters: |
|
---|---|
Returns: |
|
get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: |
|
---|---|
Returns: |
|
inverse_transform(X)
[source]
Scale back the data to the original representation
Parameters: |
|
---|
partial_fit(X, y=None)
[source]
Online computation of max absolute value of X for later scaling. All of X is processed as a single batch. This is intended for cases when fit
is not feasible due to very large number of n_samples
or because X is read from a continuous stream.
Parameters: |
|
---|
set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: |
|
---|
transform(X)
[source]
Scale the data
Parameters: |
|
---|
sklearn.preprocessing.MaxAbsScaler
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MaxAbsScaler.html