PytorchForecastingTransform¶
- class PytorchForecastingTransform(max_encoder_length: int = 30, min_encoder_length: Optional[int] = None, min_prediction_idx: Optional[int] = None, min_prediction_length: Optional[int] = None, max_prediction_length: int = 1, static_categoricals: Optional[List[str]] = None, static_reals: Optional[List[str]] = None, time_varying_known_categoricals: Optional[List[str]] = None, time_varying_known_reals: Optional[List[str]] = None, time_varying_unknown_categoricals: Optional[List[str]] = None, time_varying_unknown_reals: Optional[List[str]] = None, variable_groups: Optional[Dict[str, List[int]]] = None, constant_fill_strategy: Optional[Dict[str, Union[str, float, int, bool]]] = None, allow_missing_timesteps: bool = True, lags: Optional[Dict[str, List[int]]] = None, add_relative_time_idx: bool = True, add_target_scales: bool = True, add_encoder_length: Union[bool, str] = True, target_normalizer: Union[pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.NaNLabelEncoder, pytorch_forecasting.data.encoders.EncoderNormalizer, str, List[Union[pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.NaNLabelEncoder, pytorch_forecasting.data.encoders.EncoderNormalizer]], Tuple[Union[pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.NaNLabelEncoder, pytorch_forecasting.data.encoders.EncoderNormalizer]]] = 'auto', categorical_encoders: Optional[Dict[str, pytorch_forecasting.data.encoders.NaNLabelEncoder]] = None, scalers: Optional[Dict[str, Union[sklearn.preprocessing._data.StandardScaler, sklearn.preprocessing._data.RobustScaler, pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.EncoderNormalizer]]] = None)[source]¶
Bases:
etna.transforms.base.Transform
Transform for models from PytorchForecasting library.
Notes
This transform should be added at the very end of
transforms
parameter.Init transform.
Parameters here is used for initialization of
pytorch_forecasting.data.timeseries.TimeSeriesDataSet
object.- Inherited-members
- Parameters
max_encoder_length (int) –
min_encoder_length (Optional[int]) –
min_prediction_idx (Optional[int]) –
min_prediction_length (Optional[int]) –
max_prediction_length (int) –
static_categoricals (Optional[List[str]]) –
static_reals (Optional[List[str]]) –
time_varying_known_categoricals (Optional[List[str]]) –
time_varying_known_reals (Optional[List[str]]) –
time_varying_unknown_categoricals (Optional[List[str]]) –
time_varying_unknown_reals (Optional[List[str]]) –
variable_groups (Optional[Dict[str, List[int]]]) –
constant_fill_strategy (Optional[Dict[str, Union[str, float, int, bool]]]) –
allow_missing_timesteps (bool) –
lags (Optional[Dict[str, List[int]]]) –
add_relative_time_idx (bool) –
add_target_scales (bool) –
add_encoder_length (Union[bool, str]) –
target_normalizer (Union[pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.NaNLabelEncoder, pytorch_forecasting.data.encoders.EncoderNormalizer, str, List[Union[pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.NaNLabelEncoder, pytorch_forecasting.data.encoders.EncoderNormalizer]], Tuple[Union[pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.NaNLabelEncoder, pytorch_forecasting.data.encoders.EncoderNormalizer]]]) –
categorical_encoders (Optional[Dict[str, pytorch_forecasting.data.encoders.NaNLabelEncoder]]) –
scalers (Optional[Dict[str, Union[sklearn.preprocessing._data.StandardScaler, sklearn.preprocessing._data.RobustScaler, pytorch_forecasting.data.encoders.TorchNormalizer, pytorch_forecasting.data.encoders.EncoderNormalizer]]]) –
Methods
fit
(df)Fit TimeSeriesDataSet.
fit_transform
(df)May be reimplemented.
inverse_transform
(df)Inverse transforms dataframe.
transform
(df)Transform raw df to TimeSeriesDataSet.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.nn.pytorch_forecasting.PytorchForecastingTransform [source]¶
Fit TimeSeriesDataSet.
- Parameters
df (pandas.core.frame.DataFrame) – data to be fitted.
- Return type
- transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame [source]¶
Transform raw df to TimeSeriesDataSet.
- Parameters
df (pandas.core.frame.DataFrame) – data to be transformed.
- Return type
DataFrame
Notes
We save TimeSeriesDataSet in instance to use it in the model. It`s not right pattern of using Transforms and TSDataset.