diff --git a/aeon/classification/distance_based/_elastic_ensemble.py b/aeon/classification/distance_based/_elastic_ensemble.py index c0b0bce805..338184a235 100644 --- a/aeon/classification/distance_based/_elastic_ensemble.py +++ b/aeon/classification/distance_based/_elastic_ensemble.py @@ -413,7 +413,9 @@ def get_inclusive(min_val: float, max_val: float, num_vals: float): return np.arange(min_val, max_val + inc / 2, inc) if distance_measure == "dtw" or distance_measure == "ddtw": - return {"distance_params": [{"window": x / 100} for x in range(0, 100)]} + constrained_params = [{"window": x / 100} for x in range(1, 100)] + unconstrained_param = {"window": 1.0} + return {"distance_params": [unconstrained_param] + constrained_params} elif distance_measure == "wdtw" or distance_measure == "wddtw": return {"distance_params": [{"g": x / 100} for x in range(0, 100)]} elif distance_measure == "lcss": diff --git a/aeon/classification/distance_based/tests/test_elastic_ensemble.py b/aeon/classification/distance_based/tests/test_elastic_ensemble.py index 53215dad2f..d72927d8cb 100644 --- a/aeon/classification/distance_based/tests/test_elastic_ensemble.py +++ b/aeon/classification/distance_based/tests/test_elastic_ensemble.py @@ -90,3 +90,18 @@ def test_all_distance_measures(): ee.fit(X, y) distances = list(ee.get_metric_params()) assert len(distances) == 9 + + +@pytest.mark.parametrize("data", [DATA]) +def test_dtw_ddtw_full_window_inclusion(data): + """Test that window=1.0 (full window) is included in DTW/DDTW parameters.""" + dtw_paras = ElasticEnsemble._get_100_param_options("dtw", data) + dtw_param_values = dtw_paras["distance_params"] + dtw_windows = {p.get("window") for p in dtw_param_values} + assert 1.0 in dtw_windows + assert len(dtw_param_values) == 100 + ddtw_paras = ElasticEnsemble._get_100_param_options("ddtw", data) + ddtw_param_values = ddtw_paras["distance_params"] + ddtw_windows = {p.get("window") for p in ddtw_param_values} + assert 1.0 in ddtw_windows + assert len(ddtw_param_values) == 100 diff --git a/docs/changelogs/v1.3.md b/docs/changelogs/v1.3.md index eae8566a67..7d50d8a156 100644 --- a/docs/changelogs/v1.3.md +++ b/docs/changelogs/v1.3.md @@ -39,6 +39,7 @@ September 2025 - [ENH] KNN n_jobs and updated kneighbours method ({pr}`2578`) {user}`chrisholder` - [ENH] Refactor signature code ({pr}`2943`) {user}`TonyBagnall` - [ENH] Change seed to random_state ({pr}`3031`) {user}`TonyBagnall` +- [ENH] Include unconstrained DTW and DDTW in Elastic Ensemble ({pr}`3112`) {user}`Nithurshen` ## Clustering