Skip to content

Commit

Permalink
feature(KTP-1279): Added test to change linear model parameters.
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Dmitriev <[email protected]>
  • Loading branch information
egordm committed Oct 4, 2024
1 parent e0ebfb5 commit 870b8a8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/unit/model/regressors/test_linear_quantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sklearn.utils.estimator_checks import check_estimator

from openstef.feature_engineering.apply_features import apply_features
from openstef.model.model_creator import ModelCreator
from openstef.model.regressors.linear_quantile import LinearQuantileOpenstfRegressor
from test.unit.utils.base import BaseTestCase
from test.unit.utils.data import TestData
Expand Down Expand Up @@ -144,3 +145,22 @@ def test_ignore_features(self):
self.assertNotIn("E1B_AMI_I", input_data_filtered.columns)
self.assertNotIn("E4A_I", input_data_filtered.columns)
self.assertIn("load", input_data_filtered.columns)

def test_create_model(self):
# Arrange
kwargs = {
"weight_scale_percentile": 50,
"weight_exponent": 2,
}

# Act
model = ModelCreator.create_model(
model_type="linear_quantile",
quantiles=[0.5],
**kwargs,
)

# Assert
self.assertIsInstance(model, LinearQuantileOpenstfRegressor)
self.assertEqual(model.weight_scale_percentile, 50)
self.assertEqual(model.weight_exponent, 2)

0 comments on commit 870b8a8

Please sign in to comment.