sklearn.preprocessing.robust_scale¶
- sklearn.preprocessing.robust_scale(X, axis=0, with_centering=True, with_scaling=True, copy=True)[source]¶
Standardize a dataset along any axis
Center to the median and component wise scale according to the interquartile range.
Read more in the User Guide.
Parameters: X : array-like
The data to center and scale.
axis : int (0 by default)
axis used to compute the medians and IQR along. If 0, independently scale each feature, otherwise (if 1) scale each sample.
with_centering : boolean, True by default
If True, center the data before scaling.
with_scaling : boolean, True by default
If True, scale the data to unit variance (or equivalently, unit standard deviation).
copy : boolean, optional, default is True
set to False to perform inplace row normalization and avoid a copy (if the input is already a numpy array or a scipy.sparse CSR matrix and if axis is 1).
See also
sklearn.preprocessing.RobustScaler, scaling, sklearn.pipeline.Pipeline
Notes
This implementation will refuse to center scipy.sparse matrices since it would make them non-sparse and would potentially crash the program with memory exhaustion problems.
Instead the caller is expected to either set explicitly with_centering=False (in that case, only variance scaling will be performed on the features of the CSR matrix) or to call X.toarray() if he/she expects the materialized dense array to fit in memory.
To avoid memory copy the caller should pass a CSR matrix.