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.
preprocess(y)Preprocess input data (e.g.
Attributes
TRANSFORMATIONS- classmethod get_transform(transformation: Union[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: Union[pandas.core.series.Series, numpy.ndarray, torch.Tensor]) Union[numpy.ndarray, torch.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]
- preprocess(y: Union[pandas.core.series.Series, pandas.core.frame.DataFrame, numpy.ndarray, torch.Tensor]) Union[numpy.ndarray, torch.Tensor][source]#
Preprocess input data (e.g. take log).
Uses
transformattribute to determine how to apply transform.- Returns
return rescaled series with type depending on input type
- Return type
Union[np.ndarray, torch.Tensor]