Skip to content

Commit

Permalink
Merge pull request #252 from eonu/release/2.0.2
Browse files Browse the repository at this point in the history
release: v2.0.2
  • Loading branch information
eonu authored Apr 13, 2024
2 parents 5062288 + fe7f488 commit b5a4b0f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,12 @@ Nothing, initial release!

</details>

## [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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sequentia"
version = "2.0.1"
version = "2.0.2"
license = "MIT"
authors = ["Edwin Onuonga <ed@eonu.net>"]
maintainers = ["Edwin Onuonga <ed@eonu.net>"]
Expand Down
2 changes: 1 addition & 1 deletion sequentia/models/knn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])])

Expand Down
2 changes: 1 addition & 1 deletion sequentia/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

__all__ = ["VERSION", "version_info"]

VERSION = "2.0.1"
VERSION = "2.0.2"


def version_info() -> str:
Expand Down
20 changes: 17 additions & 3 deletions tests/unit/test_models/knn/test_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b5a4b0f

Please sign in to comment.