Standard Scaler

../../../../_images/scaler.svg

Standardize features by removing the mean and scaling to unit variance.

Centering and scaling happen independently on each feature by computing the relevant statistics on the samples in the training set. Mean and standard deviation 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: they might behave badly if the individual feature do not more or less look like standard normally distributed data (e.g. Gaussian with 0 mean and unit variance).

Configuration:

  • with_mean

    If True, center the data before scaling. This does not work (and will raise an exception) when attempted on sparse matrices, because centering them entails building a dense matrix which in common use cases is likely to be too large to fit in memory.

  • with_std

    If True, scale the data to unit variance (or equivalently, unit standard deviation).

Attributes:

  • scale_

    Per feature relative scaling of the data. This is calculated using np.sqrt(var_). Equal to None when with_std=False.

    New in version 0.17: scale_

  • mean_

    The mean value for each feature in the training set. Equal to None when with_mean=False.

  • var_

    The variance for each feature in the training set. Used to compute scale_. Equal to None when with_std=False.

  • n_samples_seen_

    The number of samples processed by the estimator for each feature. If there are not missing samples, the n_samples_seen will be an integer, otherwise it will be an array. Will be reset on new calls to fit, but increments across partial_fit calls.

Input ports:

Output ports:
model : model
Model
with_mean (with_mean)
If True, center the data before scaling. This does not work (and will raise an exception) when attempted on sparse matrices, because centering them entails building a dense matrix which in common use cases is likely to be too large to fit in memory.
with_std (with_std)
If True, scale the data to unit variance (or equivalently, unit standard deviation).

Some of the docstrings for this module have been automatically extracted from the scikit-learn library and are covered by their respective licenses.

class node_preprocessing.StandardScaler[source]