gemseo / mlearning / transform / scaler

standard_scaler module

Standard data scaler

The StandardScaler class implements the Standard scaling method applying to some parameter \(z\):

\[\bar{z} := \text{offset} + \text{coefficient}\times z = \frac{z-\text{mean}(z)}{\text{std}(z)}\]

where \(\text{offset}=-\text{mean}(z)/\text{std}(z)\) and \(\text{coefficient}=1/\text{std}(z)\).

In this Standard scaling method, the scaling operation linearly transforms the original variable math:z such that in the scaled space, the original data have zero mean and unit standard deviation.

class gemseo.mlearning.transform.scaler.standard_scaler.StandardScaler(name='StandardScaler', offset=0.0, coefficient=1.0)[source]

Bases: gemseo.mlearning.transform.scaler.scaler.Scaler

Standard scaler.

Constructor.

Parameters
  • name (str) – name of the scaler. Default: ‘StandardScaler’.

  • offset (float) – offset of the linear transformation. Default: 0.

  • coefficient (float) – coefficient of the linear transformation. Default: 1.

fit(data)[source]

Fit offset and coefficient terms from a data array. The mean and standard deviation are computed along the first axis of the data.

Parameters

data (array) – data to be fitted.