gemseo / mlearning / transform / scaler

scaler module

Data scaler

The Scaler class implements the default scaling method applying to some parameter \(z\):

\[\bar{z} := \text{offset} + \text{coefficient}\times z\]

where \(\bar{z}\) is the scaled version of z. This scaling method is a linear transformation parameterized by an offset and a coefficient.

In this default scaling method, the offset is equal to 0 and the coefficient is equal to 1. Consequently, the scaling operation is the identity: \(\bar{z}=z\). This method has to be overloaded.

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

Bases: gemseo.mlearning.transform.transformer.Transformer

Data scaler.

Constructor.

Parameters
  • name (str) – name of the scaler.

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

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

property coefficient

Coefficient.

compute_jacobian(data)[source]

Compute Jacobian of the scaler transform.

Parameters

data (ndarray) – data where the Jacobian is to be computed.

Returns

Jacobian matrix.

Return type

ndarray

compute_jacobian_inverse(data)[source]

Compute Jacobian of the scaler inverse_transform.

Parameters

data (ndarray) – data where the Jacobian is to be computed.

Returns

Jacobian matrix.

Return type

ndarray

fit(data)[source]

Fit scaler to data. Offset and coefficient terms are already defined in the constructor.

Parameters

data (ndarray) – data to be fitted.

inverse_transform(data)[source]

Unscale data using the offset and coefficient terms.

Parameters

data (ndarray) – data to be inverse transformed.

Returns

inverse transformed data.

Return type

ndarray

property offset

Offset.

transform(data)[source]

Scale data using the offset and coefficient terms.

Parameters

data (ndarray) – data to be transformed.

Returns

transformed data.

Return type

ndarray