TransformMixIn#
- class pytorch_forecasting.data.encoders.TransformMixIn[source]#
Bases:
objectMixin for providing pre- and post-processing capabilities to encoders.
Class should have a
transformationattribute to indicate how to preprocess data.- Inherited-members:
Methods
get_transform(transformation)Return transformation functions.
Inverse preprocess re-scaled data (e.g. take exp).
preprocess(y)Preprocess input data (e.g. take log).
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
transformattribute to determine how to apply inverse transform.- Returns:
return rescaled series with type depending on input type
- Return type:
Union[np.ndarray, torch.Tensor]