Skip to content

Commit

Permalink
Release v2.5.10
Browse files Browse the repository at this point in the history
Fixup the KD-Tree algorithm
  • Loading branch information
gmrukwa committed Aug 11, 2020
2 parents 735f9fd + 3932146 commit 61e3d9c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
env:
MAJOR: ${{ 2 }}
MINOR: ${{ 5 }}
FIXUP: ${{ 9 }}
FIXUP: ${{ 10 }}
PACKAGE_INIT_FILE: ${{ 'divik/__init__.py' }}
PACKAGE_INIT_FILE_VERSION_LINE: ${{ 1 }}
PACKAGE_SETUP_FILE: ${{ 'setup.py' }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ docker pull gmrukwa/divik
To install specific version, you can specify it in the command, e.g.:

```bash
docker pull gmrukwa/divik:2.5.9
docker pull gmrukwa/divik:2.5.10
```

## Python package
Expand Down Expand Up @@ -79,7 +79,7 @@ pip install divik
or any stable tagged version, e.g.:

```bash
pip install divik==2.5.9
pip install divik==2.5.10
```

If you want to have compatibility with
Expand Down
2 changes: 1 addition & 1 deletion divik/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '2.5.9'
__version__ = '2.5.10'

from ._summary import plot, reject_split

Expand Down
5 changes: 4 additions & 1 deletion divik/cluster/_kmeans/_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,16 @@ def make_tree(X, leaf_size: int, _feature_idx: int = 0, selector=None) \
selector = np.ones((X.shape[0],), dtype=bool)
if selector.sum() < 2 * leaf_size:
centroid = X[selector, :].mean(axis=0, keepdims=True)
return Leaf(centroid, X.shape[0])
return Leaf(centroid, int(selector.sum()))
feature = X[selector, _feature_idx]
thr = np.mean(feature)
left_idx = selector.copy()
left_idx[selector] = feature < thr
right_idx = selector.copy()
right_idx[selector] = np.logical_not(left_idx[selector])
if left_idx[selector].all() or right_idx[selector].all():
centroid = X[selector, :].mean(axis=0, keepdims=True)
return Leaf(centroid, int(selector.sum()))
next_feature = (_feature_idx + 1) % X.shape[1]
return Node(
left=make_tree(X, leaf_size=leaf_size,
Expand Down
4 changes: 2 additions & 2 deletions docs/instructions/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To install latest stable version use::

To install specific version, you can specify it in the command, e.g.::

docker pull gmrukwa/divik:2.5.9
docker pull gmrukwa/divik:2.5.10

Python package
--------------
Expand All @@ -31,7 +31,7 @@ package::

or any stable tagged version, e.g.::

pip install divik==2.5.9
pip install divik==2.5.10

If you want to have compatibility with
`gin-config <https://github.com/google/gin-config>`_, you can install
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys
import numpy

__version__ = '2.5.9'
__version__ = '2.5.10'

LINUX_OPTS = {
'extra_link_args': [
Expand Down

0 comments on commit 61e3d9c

Please sign in to comment.