Skip to content

Commit

Permalink
remove T-1D and T-7D from TO_KEEP_FEATURES in gblinear_quantile (Open…
Browse files Browse the repository at this point in the history
…STEF#592)

* remove T-1D and T-7D from TO_KEEP_FEATURES in gblinear_quantile

Signed-off-by: lschilders <[email protected]>

* add back T-7D from TO_KEEP_FEATURES in gblinear_quantile

Signed-off-by: lschilders <[email protected]>

* fix test for TO_KEEP_FEATURES

Signed-off-by: lschilders <[email protected]>

---------

Signed-off-by: lschilders <[email protected]>
  • Loading branch information
lschilders authored Feb 18, 2025
1 parent 78abac5 commit d520e02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion openstef/model/regressors/gblinear_quantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class GBLinearQuantileOpenstfRegressor(OpenstfRegressor):

TO_KEEP_FEATURES: List[str] = [
"T-7d",
"T-1d",
]
TO_IGNORE_FEATURES: List[str] = [
"Month",
Expand Down
7 changes: 5 additions & 2 deletions test/unit/model/regressors/test_gblinear_quantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def test_ignore_features(self):
input_data_engineered["E1B_AMI_I"] = 1
input_data_engineered["E4A_I"] = 1

self.assertIn("T-1d", input_data_engineered.columns)
for feat in model.TO_KEEP_FEATURES:
self.assertIn(feat, input_data_engineered.columns)
self.assertIn("T-7d", input_data_engineered.columns)
self.assertIn("is_eerste_kerstdag", input_data_engineered.columns)
self.assertIn("Month", input_data_engineered.columns)
self.assertIn("load", input_data_engineered.columns)
Expand All @@ -142,7 +144,8 @@ def test_ignore_features(self):
input_data_filtered = model._remove_ignored_features(input_data_engineered)

# Assert
self.assertIn("T-1d", input_data_filtered.columns) # T-1d should be kept
for feat in model.TO_KEEP_FEATURES:
self.assertIn(feat, input_data_filtered.columns)
self.assertNotIn("is_eerste_kerstdag", input_data_filtered.columns)
self.assertNotIn("Month", input_data_filtered.columns)
self.assertNotIn("E1B_AMI_I", input_data_filtered.columns)
Expand Down

0 comments on commit d520e02

Please sign in to comment.