gemseo / mlearning / transform

pipeline module

A pipeline to chain transformers.

The Pipeline class chains a sequence of tranformers, and provides global fit(), transform(), fit_transform() and inverse_transform() methods.

Classes:

Pipeline([name, transformers])

Transformer pipeline.

class gemseo.mlearning.transform.pipeline.Pipeline(name='Pipeline', transformers=None)[source]

Bases: gemseo.mlearning.transform.transformer.Transformer

Transformer pipeline.

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

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

  • transformers (Sequence(Transformer)) – The sequence of transformers.

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

  • transformers (Optional[Sequence[Transformer]]) – A sequence of transformers to be chained. The transformers are chained in the order of appearance in the list, i.e. the first transformer is applied first. If transformers is an empty list or None, then the pipeline transformer behaves like an identity transformer.

Return type

None

Attributes:

CROSSED

Methods:

compute_jacobian(data)

Compute the Jacobian of the pipeline.transform().

compute_jacobian_inverse(data)

Compute the Jacobian of the pipeline.inverse_transform().

duplicate()

Duplicate the current object.

fit(data, **options)

Fit the transformer pipeline 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
compute_jacobian(data)[source]

Compute the Jacobian of the pipeline.transform().

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

  • data – The data where the Jacobian is to be computed.

Returns

The Jacobian matrix. The Jacobian matrix.

Return type

numpy.ndarray

compute_jacobian_inverse(data)[source]

Compute the Jacobian of the pipeline.inverse_transform().

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

  • data – The data where the Jacobian is to be computed.

Returns

The Jacobian matrix. The Jacobian matrix.

Return type

numpy.ndarray

duplicate()[source]

Duplicate the current object.

Returns

A deepcopy of the current instance. A deepcopy of the current instance.

Return type

gemseo.mlearning.transform.pipeline.Pipeline

fit(data, **options)[source]

Fit the transformer pipeline to the data.

All the transformers are fitted, transforming the data in place.

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

  • data – The data to be fitted.

  • options (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.

The data is inverse transformed sequentially, starting with the last transformer in the list.

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

  • data – The data to be inverse transformed.

Returns

The inverse transformed data. The inverse transformed data.

Return type

numpy.ndarray

transform(data)[source]

Transform the data.

The data is transformed sequentially, where the output of one transformer is the input of the next.

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

  • data – The data to be transformed.

Returns

The transformed data. The transformed data.

Return type

numpy.ndarray