TransformMixIn#

class pytorch_forecasting.data.encoders.TransformMixIn[source]#

Bases: object

Mixin for providing pre- and post-processing capabilities to encoders.

Class should have a transformation attribute to indicate how to preprocess data.

Inherited-members:

Methods

get_transform(transformation)

Return transformation functions.

inverse_preprocess(y)

Inverse preprocess re-scaled data (e.g.

preprocess(y)

Preprocess input data (e.g.

Attributes

TRANSFORMATIONS

classmethod get_transform(transformation: str | Dict[str, Callable]) Dict[str, Callable][source]#

Return transformation functions.

Parameters:

transformation (Union[str, Dict[str, Callable]]) – name of transformation or dictionary with transformation information.

Returns:

dictionary with transformation functions (forward, reverse, inverse and inverse_torch)

Return type:

Dict[str, Callable]

inverse_preprocess(y: Series | ndarray | Tensor) ndarray | Tensor[source]#

Inverse preprocess re-scaled data (e.g. take exp).

Uses transform attribute to determine how to apply inverse transform.

Returns:

return rescaled series with type depending on input type

Return type:

Union[np.ndarray, torch.Tensor]

preprocess(y: Series | DataFrame | ndarray | Tensor) ndarray | Tensor[source]#

Preprocess input data (e.g. take log).

Uses transform attribute to determine how to apply transform.

Returns:

return rescaled series with type depending on input type

Return type:

Union[np.ndarray, torch.Tensor]