standard_scaler module¶
Scaling a variable with a statistical linear transformation.
The StandardScaler
class implements the Standard scaling method
applying to some parameter \(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.
Classes:
|
Standard scaler. |
- 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.
- name¶
The name of the transformer.
- Type
str
- parameters¶
The parameters of the transformer.
- Type
str
- Parameters
name (str) –
A name for this transformer.
By default it is set to StandardScaler.
offset (float) –
The offset of the linear transformation.
By default it is set to 0.0.
coefficient (float) –
The coefficient of the linear transformation.
By default it is set to 1.0.
- Return type
None
Attributes:
The scaling coefficient.
The scaling offset.
Methods:
compute_jacobian
(data)Compute Jacobian of transformer.transform().
compute_jacobian_inverse
(data)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.
inverse_transform
(data)Perform an inverse transform on the data.
transform
(data)Transform the data.
- CROSSED = False¶
- property coefficient¶
The scaling coefficient.
- compute_jacobian(data)¶
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)¶
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
- 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)¶
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)¶
Transform the data.
- Parameters
data (numpy.ndarray) – The data to be transformed.
- Returns
The transformed data.
- Return type
numpy.ndarray