class sklearn.preprocessing.RobustScaler(with_centering=True, with_scaling=True, quantile_range=(25.0, 75.0), copy=True)
[source]
Scale features using statistics that are robust to outliers.
This Scaler removes the median and scales the data according to the quantile range (defaults to IQR: Interquartile Range). The IQR is the range between the 1st quartile (25th quantile) and the 3rd quartile (75th quantile).
Centering and scaling happen independently on each feature by computing the relevant statistics on the samples in the training set. Median and interquartile range are then stored to be used on later data using the transform
method.
Standardization of a dataset is a common requirement for many machine learning estimators. Typically this is done by removing the mean and scaling to unit variance. However, outliers can often influence the sample mean / variance in a negative way. In such cases, the median and the interquartile range often give better results.
New in version 0.17.
Read more in the User Guide.
Parameters: 


Attributes: 

See also
robust_scale
sklearn.decomposition.PCA
For a comparison of the different scalers, transformers, and normalizers, see examples/preprocessing/plot_all_scaling.py.
https://en.wikipedia.org/wiki/Median https://en.wikipedia.org/wiki/Interquartile_range
>>> from sklearn.preprocessing import RobustScaler >>> X = [[ 1., 2., 2.], ... [ 2., 1., 3.], ... [ 4., 1., 2.]] >>> transformer = RobustScaler().fit(X) >>> transformer RobustScaler(copy=True, quantile_range=(25.0, 75.0), with_centering=True, with_scaling=True) >>> transformer.transform(X) array([[ 0. , 2. , 0. ], [1. , 0. , 0.4], [ 1. , 0. , 1.6]])
fit (X[, y])  Compute the median and quantiles to be used for 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 
set_params (**params)  Set the parameters of this estimator. 
transform (X)  Center and scale the data. 
__init__(with_centering=True, with_scaling=True, quantile_range=(25.0, 75.0), copy=True)
[source]
fit(X, y=None)
[source]
Compute the median and quantiles to be used for 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: 


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]
Center and scale the data.
Parameters: 


sklearn.preprocessing.RobustScaler
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.preprocessing.RobustScaler.html