Skip to content

Commit 4c30351

Browse files
authored
[ENH] EXPERIMENTAL PR: make the data_module dataclass-like (#1832)
This PR makes the `data_modulel` dataclass-like See discussion in #1829
1 parent fc8599c commit 4c30351

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

pytorch_forecasting/data/data_module.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,6 @@ def __init__(
163163
else:
164164
self.continuous_indices.append(idx)
165165

166-
# overwrite __init__ params for upwards compatibility with AS PRs
167-
# todo: should we avoid this and ensure classes are dataclass-like?
168-
self.min_prediction_length = self._min_prediction_length
169-
self.min_encoder_length = self._min_encoder_length
170-
self.categorical_encoders = self._categorical_encoders
171-
self.scalers = self._scalers
172-
self.target_normalizer = self._target_normalizer
173-
174166
def _prepare_metadata(self):
175167
"""Prepare metadata for model initialisation.
176168

tests/test_data/test_data_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def test_init(sample_timeseries_data):
8686

8787
assert dm.max_encoder_length == 24
8888
assert dm.max_prediction_length == 12
89-
assert dm.min_encoder_length == 24
90-
assert dm.min_prediction_length == 12
89+
assert dm._min_encoder_length == 24
90+
assert dm._min_prediction_length == 12
9191
assert dm.batch_size == 8
9292
assert dm.train_val_test_split == (0.7, 0.15, 0.15)
9393

0 commit comments

Comments
 (0)