From c2c34aa08fb08fec9e4f793a73e58c88d7b905dd Mon Sep 17 00:00:00 2001 From: Aryan Saini Date: Tue, 13 May 2025 21:01:38 +0530 Subject: [PATCH 1/2] try to make dataclass-like --- pytorch_forecasting/data/data_module.py | 10 +++++----- tests/test_data/test_data_module.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pytorch_forecasting/data/data_module.py b/pytorch_forecasting/data/data_module.py index c8252014d..0e0e44a46 100644 --- a/pytorch_forecasting/data/data_module.py +++ b/pytorch_forecasting/data/data_module.py @@ -165,11 +165,11 @@ def __init__( # overwrite __init__ params for upwards compatibility with AS PRs # todo: should we avoid this and ensure classes are dataclass-like? - self.min_prediction_length = self._min_prediction_length - self.min_encoder_length = self._min_encoder_length - self.categorical_encoders = self._categorical_encoders - self.scalers = self._scalers - self.target_normalizer = self._target_normalizer + # self.min_prediction_length = self._min_prediction_length + # self.min_encoder_length = self._min_encoder_length + # self.categorical_encoders = self._categorical_encoders + # self.scalers = self._scalers + # self.target_normalizer = self._target_normalizer def _prepare_metadata(self): """Prepare metadata for model initialisation. diff --git a/tests/test_data/test_data_module.py b/tests/test_data/test_data_module.py index 4051b852c..7388b510c 100644 --- a/tests/test_data/test_data_module.py +++ b/tests/test_data/test_data_module.py @@ -86,8 +86,8 @@ def test_init(sample_timeseries_data): assert dm.max_encoder_length == 24 assert dm.max_prediction_length == 12 - assert dm.min_encoder_length == 24 - assert dm.min_prediction_length == 12 + assert dm._min_encoder_length == 24 + assert dm._min_prediction_length == 12 assert dm.batch_size == 8 assert dm.train_val_test_split == (0.7, 0.15, 0.15) From 5ae6e51239fd6e492af33a607748f30cb3f17511 Mon Sep 17 00:00:00 2001 From: Aryan Saini Date: Sat, 17 May 2025 11:03:53 +0530 Subject: [PATCH 2/2] remove the commented out block --- pytorch_forecasting/data/data_module.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pytorch_forecasting/data/data_module.py b/pytorch_forecasting/data/data_module.py index 10a0174f2..ec3c11de9 100644 --- a/pytorch_forecasting/data/data_module.py +++ b/pytorch_forecasting/data/data_module.py @@ -163,14 +163,6 @@ def __init__( else: self.continuous_indices.append(idx) - # overwrite __init__ params for upwards compatibility with AS PRs - # todo: should we avoid this and ensure classes are dataclass-like? - # self.min_prediction_length = self._min_prediction_length - # self.min_encoder_length = self._min_encoder_length - # self.categorical_encoders = self._categorical_encoders - # self.scalers = self._scalers - # self.target_normalizer = self._target_normalizer - def _prepare_metadata(self): """Prepare metadata for model initialisation.