gemseo / mlearning / transform / power

boxcox module

A Box-Cox power transformation.

Transform a variable \(x\) as:

\[\begin{split}y & = (x^\lambda - 1) / \lambda, \text{for } \lambda \neq 0 \\\\ & = \log(x), \text{for } \lambda = 0\end{split}\]

Dependence

This transformation algorithm relies on the PowerTransformer class of scikit-learn.

class gemseo.mlearning.transform.power.boxcox.BoxCox(name=None, standardize=True)[source]

Bases: Power

A Box-Cox power transformation.

Parameters:
  • name (str) – A name for this transformer. If None, use the class name.

  • standardize (bool) –

    Whether to apply zero-mean, unit-variance normalization to the transformed output.

    By default it is set to True.

compute_jacobian(data)

Compute the Jacobian of transform().

Parameters:

data (ndarray) – The data where the Jacobian is to be computed, shaped as (n_observations, n_features) or (n_features, ).

Returns:

The Jacobian matrix, shaped according to data.

Return type:

NoReturn

compute_jacobian_inverse(data)

Compute the Jacobian of the inverse_transform().

Parameters:

data (ndarray) – The data where the Jacobian is to be computed, shaped as (n_observations, n_features) or (n_features, ).

Returns:

The Jacobian matrix, shaped according to data..

Return type:

NoReturn

duplicate()

Duplicate the current object.

Returns:

A deepcopy of the current instance.

Return type:

Transformer

fit(data, *args)

Fit the transformer to the data.

Parameters:
  • data (ndarray) – The data to be fitted, shaped as (n_observations, n_features) or (n_observations, ).

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

Return type:

None

fit_transform(data, *args)

Fit the transformer to the data and transform the data.

Parameters:
  • data (ndarray) – The data to be transformed, shaped as (n_observations, n_features) or (n_observations, ).

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

Returns:

The transformed data, shaped as data.

Return type:

ndarray

inverse_transform(data, *args, **kwargs)

Force a NumPy array to be 2D and evaluate the function f with it.

Parameters:
  • data (ndarray) – A 1D or 2D NumPy array.

  • *args (Any) – The description is missing.

  • **kwargs (Any) – The description is missing.

Returns:

Any kind of output; if a NumPy array, its dimension is made consistent with the shape of data.

Return type:

Any

transform(data, *args, **kwargs)

Force a NumPy array to be 2D and evaluate the function f with it.

Parameters:
  • data (ndarray) – A 1D or 2D NumPy array.

  • *args (Any) – The description is missing.

  • **kwargs (Any) – The description is missing.

Returns:

Any kind of output; if a NumPy array, its dimension is made consistent with the shape of data.

Return type:

Any

CROSSED: ClassVar[bool] = False

Whether the fit() method requires two data arrays.

property is_fitted: bool

Whether the transformer has been fitted from some data.

lambdas_: ndarray

The parameters of the power transformation for the selected features.

name: str

The name of the transformer.

property parameters: dict[str, Union[bool, int, float, numpy.ndarray, str, NoneType]]

The parameters of the transformer.