openfl.pipelines.pipeline.Transformer

openfl.pipelines.pipeline.Transformer#

class openfl.pipelines.pipeline.Transformer[source]#

Bases: object

Base class for data transformation.

This class defines the basic structure of a data transformer. It should be subclassed when implementing new types of data transformations.

__init__()#

Methods

__init__()

backward(data, metadata, **kwargs)

Backward pass data transformation.

forward(data, **kwargs)

Forward pass data transformation.

backward(data, metadata, **kwargs)[source]#

Backward pass data transformation.

Implement the data transformation needed when going the opposite direction to the forward method. This method should be overridden by all subclasses.

Parameters:
  • data – The transformed data.

  • metadata – The metadata for the transformation.

  • **kwargs – Additional keyword arguments for the transformation.

Returns:

The original data before the transformation.

Return type:

transformed_data

forward(data, **kwargs)[source]#

Forward pass data transformation.

Implement the data transformation. This method should be overridden by all subclasses.

Parameters:
  • data – The data to be transformed.

  • **kwargs – Additional parameters to pass to the function

Returns:

The transformed data. metadata: The metadata for the transformation.

Return type:

transformed_data