SIENTIAPDE-1430: Introduce static_threshold parameter for static window removal.

This parameter allows customizing the threshold (1-1000) used when rem_static_win is enabled, defaulting to 1 if null.
Updates include parameter definition, business rule validation, repository logic for passing the threshold, documentation in README.md and PIPELINE_PARAMS_CHANGELOG.md, and new unit and integration tests.
This commit is contained in:
Bruno Domingues
2025-12-19 15:44:18 -03:00
parent 7cbb7022e5
commit 06571011f2
10 changed files with 174 additions and 3 deletions

View File

@@ -55,6 +55,8 @@ def mock_train_result():
result.params.include_ar = False
result.params.train_size = 80
result.params.removed_intervals = []
result.params.rem_static_win = True
result.params.static_threshold = None
result.run_name = 'test_run'
result.run_dir = '/tmp/test_run' # noqa: S108
result.report_path = '/tmp/test_run/report.html' # noqa: S108

View File

@@ -56,6 +56,7 @@ def sample_params():
end_date=None,
scaler_name='None',
support_filters={},
static_threshold=None,
)
@@ -137,6 +138,7 @@ class TestExtractModelEquation:
end_date=None,
scaler_name='None',
support_filters={},
static_threshold=None,
)
# Mock model with single coefficient
@@ -221,12 +223,33 @@ class TestInitDataPreprocessor:
assert preprocessor.ar_var is None
def test_init_preprocessor_with_static_removal(self, training_repo, sample_params):
"""Test preprocessor with static window removal enabled."""
"""Test preprocessor with static window removal enabled and no static_threshold."""
sample_params.rem_static_win = True
sample_params.static_threshold = None
preprocessor = training_repo._init_data_preprocessor(sample_params)
assert preprocessor.static_threshold == 1
def test_init_preprocessor_with_static_removal_custom_threshold(
self, training_repo, sample_params
):
"""Test preprocessor with static window removal and custom static_threshold."""
sample_params.rem_static_win = True
sample_params.static_threshold = 500
preprocessor = training_repo._init_data_preprocessor(sample_params)
assert preprocessor.static_threshold == 500
def test_init_preprocessor_without_static_removal_ignores_threshold(
self, training_repo, sample_params
):
"""Test preprocessor without static removal ignores static_threshold."""
sample_params.rem_static_win = False
sample_params.static_threshold = 500
preprocessor = training_repo._init_data_preprocessor(sample_params)
assert preprocessor.static_threshold is None
def test_init_preprocessor_lag_configuration(self, training_repo, sample_params):
"""Test preprocessor lag configuration."""
sample_params.lag_train = {'var1': 5, 'var2': 5, 'var3': 5}