gemseo / mlearning / transform / scaler

# scaler module¶

Scaling a variable with a linear transformation.

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.

Classes:

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

Data scaler.

Attributes
• name (str) – The name of the transformer.

• parameters (str) – The parameters of the transformer.

Parameters
• name (str) – A name for this transformer.

• offset (float) – The offset of the linear transformation.

• coefficient (float) – The coefficient of the linear transformation.

Return type

None

Attributes:

 CROSSED coefficient The scaling coefficient. offset The scaling offset.

Methods:

 Compute Jacobian of transformer.transform(). Compute Jacobian of the transformer.inverse_transform(). Duplicate the current object. fit(data, *args) Fit the transformer to the data. fit_transform(data, *args) Fit the transformer to the data and transform the data. Perform an inverse transform on the data. transform(data) Transform the data.
CROSSED = False
property coefficient

The scaling coefficient.

compute_jacobian(data)[source]

Compute Jacobian of transformer.transform().

Parameters

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

Returns

The Jacobian matrix.

Return type

numpy.ndarray

compute_jacobian_inverse(data)[source]

Compute Jacobian of the transformer.inverse_transform().

Parameters

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

Returns

The Jacobian matrix.

Return type

numpy.ndarray

duplicate()

Duplicate the current object.

Returns

A deepcopy of the current instance.

Return type

gemseo.mlearning.transform.transformer.Transformer

fit(data, *args)[source]

Fit the transformer to the data.

Parameters
• data (numpy.ndarray) – The data to be fitted.

• args (Union[float, int, str]) –

Return type

None

fit_transform(data, *args)

Fit the transformer to the data and transform the data.

Parameters
• data (numpy.ndarray) – The data to be transformed.

• args (Union[float, int, str]) –

Returns

The transformed data.

Return type

numpy.ndarray

inverse_transform(data)[source]

Perform an inverse transform on the data.

Parameters

data (numpy.ndarray) – The data to be inverse transformed.

Returns

The inverse transformed data.

Return type

numpy.ndarray

property offset

The scaling offset.

transform(data)[source]

Transform the data.

Parameters

data (numpy.ndarray) – The data to be transformed.

Returns

The transformed data.

Return type

numpy.ndarray