pyanno4rt.learning_model.preprocessing.transformers

Data transformers module.


The module aims to provide methods and classes for data transformation.

Overview

Classes

Identity

Identity transformer class.

StandardScaler

Standard scaling transformer class.

Whitening

Whitening transformer class.

Attributes

transformer_map

-

Classes

class pyanno4rt.learning_model.preprocessing.transformers.Identity[source]

Identity transformer class.

This class provides methods to fit, transform and gradientize the input features by their identity (default preprocessing step).

Overview

Methods

fit(features, labels)

Fit the identity transformer.

transform(features, labels)

Transform the input features/labels.

compute_gradient(features)

Compute the identity transformer gradient w.r.t the input features.

Members

fit(features, labels)[source]

Fit the identity transformer.

Parameters:
  • features (ndarray) – Values of the input features.

  • labels (None or ndarray) – Values of the input labels.

transform(features, labels)[source]

Transform the input features/labels.

Parameters:
  • features (ndarray) – Values of the input features.

  • labels (None or ndarray) – Values of the input labels.

Returns:

  • ndarray – Transformed values of the input features.

  • None or ndarray – Transformed values of the input labels.

compute_gradient(features)[source]

Compute the identity transformer gradient w.r.t the input features.

Parameters:

features (ndarray) – Values of the input features.

Returns:

Value of the identity transformer gradient.

Return type:

ndarray

class pyanno4rt.learning_model.preprocessing.transformers.StandardScaler(center=True, scale=True)[source]

Standard scaling transformer class.

This class provides methods to fit, transform and gradientize the input features by their z-score.

Parameters:
  • center (bool, default=True) – Indicator for the centering of the data by the mean values.

  • scale (bool, default=True) – Indicator for the scaling of the data by the standard deviations.

center

See ‘Parameters’.

Type:

bool

scale

See ‘Parameters’.

Type:

bool

means

Mean values of the features (if center is false, set to zeros).

Type:

ndarray

deviations

Standard deviations of the features (if scale is false, set to ones).

Type:

ndarray

Overview

Methods

fit(features, labels)

Fit the standard scaling transformer.

transform(features, labels)

Transform the input features/labels.

compute_gradient(features)

Compute the standard scaling transformer gradient w.r.t the input features.

Members

fit(features, labels)[source]

Fit the standard scaling transformer.

Parameters:
  • features (ndarray) – Values of the input features.

  • labels (None or ndarray) – Values of the input labels.

transform(features, labels)[source]

Transform the input features/labels.

Parameters:
  • features (ndarray) – Values of the input features.

  • labels (None or ndarray) – Values of the input labels.

Returns:

  • ndarray – Transformed values of the input features.

  • None or ndarray – Transformed values of the input labels.

compute_gradient(features)[source]

Compute the standard scaling transformer gradient w.r.t the input features.

Parameters:

features (ndarray) – Values of the input features.

Returns:

Value of the standard scaling transformer gradient.

Return type:

ndarray

class pyanno4rt.learning_model.preprocessing.transformers.Whitening(method='zca')[source]

Whitening transformer class.

This class provides methods to fit, transform and gradientize the input features by their whitening matrix.

Parameters:

method ({'pca', 'zca'}, default='zca') –

Method for the computation of the whitening matrix.

  • ’zca’ : zero-phase component analysis (Mahalanobis transformation)

  • ’pca’ : principal component analysis

method

See ‘Parameters’.

Type:

{‘pca’, ‘zca’}

means

Mean values of the features.

Type:

ndarray

matrix

Whitening matrix.

Type:

ndarray

Overview

Methods

fit(features, labels)

Fit the whitening transformer.

transform(features, labels)

Transform the input features/labels.

compute_gradient(features)

Compute the whitening transformer gradient w.r.t the input features.

Members

fit(features, labels)[source]

Fit the whitening transformer.

Parameters:
  • features (ndarray) – Values of the input features.

  • labels (None or ndarray) – Values of the input labels.

transform(features, labels)[source]

Transform the input features/labels.

Parameters:
  • features (ndarray) – Values of the input features.

  • labels (None or ndarray) – Values of the input labels.

Returns:

  • ndarray – Transformed values of the input features.

  • None or ndarray – Transformed values of the input labels.

compute_gradient(features)[source]

Compute the whitening transformer gradient w.r.t the input features.

Parameters:

features (ndarray) – Values of the input features.

Returns:

Value of the whitening transformer gradient.

Return type:

ndarray

Attributes

pyanno4rt.learning_model.preprocessing.transformers.transformer_map