diff --git a/CHANGELOG.md b/CHANGELOG.md index 6211c7a..c141487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -388,6 +388,12 @@ Nothing, initial release! +## [v2.0.2](https://github.com/eonu/sequentia/releases/tag/v2.0.2) - 2024-04-13 + +### Bug Fixes + +- call `KNNMixin._dtw1d` when `independent=True` ([#251](https://github.com/eonu/sequentia/issues/251)) + ## [v2.0.1](https://github.com/eonu/sequentia/releases/tag/v2.0.1) - 2024-04-02 ### Bug Fixes diff --git a/docs/source/conf.py b/docs/source/conf.py index e887414..deb2e21 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ project = "sequentia" copyright = "2019-2025, Sequentia Developers" # noqa: A001 author = "Edwin Onuonga (eonu)" -release = "2.0.1" +release = "2.0.2" # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index c4a5126..e20d3db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sequentia" -version = "2.0.1" +version = "2.0.2" license = "MIT" authors = ["Edwin Onuonga "] maintainers = ["Edwin Onuonga "] diff --git a/sequentia/models/knn/base.py b/sequentia/models/knn/base.py index f60687c..d2d91e9 100644 --- a/sequentia/models/knn/base.py +++ b/sequentia/models/knn/base.py @@ -206,7 +206,7 @@ def _dtwi(self: KNNMixin, A: FloatArray, B: FloatArray) -> float: def dtw(a: FloatArray, b: FloatArray) -> float: """Windowed DTW wrapper function.""" - return self._dtw(a, b, window=window) + return self._dtw1d(a, b, window=window) return np.sum([dtw(A[:, i], B[:, i]) for i in range(A.shape[1])]) diff --git a/sequentia/version.py b/sequentia/version.py index 7bcf2d1..bcec5ca 100644 --- a/sequentia/version.py +++ b/sequentia/version.py @@ -33,7 +33,7 @@ __all__ = ["VERSION", "version_info"] -VERSION = "2.0.1" +VERSION = "2.0.2" def version_info() -> str: diff --git a/tests/unit/test_models/knn/test_classifier.py b/tests/unit/test_models/knn/test_classifier.py index ce3b0e8..15f4544 100644 --- a/tests/unit/test_models/knn/test_classifier.py +++ b/tests/unit/test_models/knn/test_classifier.py @@ -46,18 +46,32 @@ def assert_fit(clf: KNNClassifier, /, *, data: SequentialDataset) -> None: @pytest.mark.parametrize("k", [1, 2, 5]) @pytest.mark.parametrize("weighting", [None, lambda x: np.exp(-x)]) +@pytest.mark.parametrize("independent", [False, True]) def test_classifier_e2e( helpers: t.Any, request: SubRequest, - k: int, - weighting: t.Callable | None, dataset: SequentialDataset, random_state: np.random.RandomState, + *, + k: int, + weighting: t.Callable | None, + independent: bool, ) -> None: - clf = KNNClassifier(k=k, weighting=weighting, random_state=random_state) + clf = KNNClassifier( + k=k, + weighting=weighting, + independent=independent, + random_state=random_state, + ) assert clf.k == k assert clf.weighting == weighting + assert clf.independent == independent + + if independent: + assert clf._dtw().__name__ == "_dtwi" + else: + assert clf._dtw().__name__ == "_dtwd" data = dataset.copy() data._X = data._X[:, :1] # only use one feature