Skip to content

Commit

Permalink
Merge pull request #54 from gmrukwa/fixup-percentiles-normalization
Browse files Browse the repository at this point in the history
Fixup percentiles normalization
  • Loading branch information
gmrukwa committed Feb 22, 2020
2 parents e62447f + 928ef02 commit 106dad1
Show file tree
Hide file tree
Showing 7 changed files with 18 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: ${{ 4 }}
FIXUP: ${{ 7 }}
FIXUP: ${{ 8 }}
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.4.7
docker pull gmrukwa/divik:2.4.8
```

## 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.4.7
pip install divik==2.4.8
```

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.4.7'
__version__ = '2.4.8'

from ._summary import plot, reject_split

Expand Down
2 changes: 1 addition & 1 deletion divik/cluster/_kmeans/_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def __call__(self, data: Data, number_of_centroids: int) -> Centroids:
leaves = get_leaves(tree)
box_centroids = np.vstack([l.centroid for l in leaves])
box_weights = np.array([l.count for l in leaves])
normalized_weights = box_weights / np.sum(box_weights)
normalized_weights = 100 * box_weights / np.sum(box_weights)

residuals = _find_residuals(box_centroids, box_weights)
centroids = np.nan * np.zeros((number_of_centroids, data.shape[1]))
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.4.7
docker pull gmrukwa/divik:2.4.8

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

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

pip install divik==2.4.7
pip install divik==2.4.8

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.4.7'
__version__ = '2.4.8'

LINUX_OPTS = {
'extra_link_args': [
Expand Down
10 changes: 10 additions & 0 deletions test/cluster/kmeans/test_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ class PercentileInitializationTest(ExtremeInitializationTest):
def setUp(self):
self.number_of_clusters = 2
self.initialize = km.PercentileInitialization('euclidean')


class KDTreePercentileInitializationTest(unittest.TestCase):
def setUp(self):
self.number_of_clusters = 2
self.initialize = km.KDTreePercentileInitialization(
'euclidean', 0.1, 99.)

def test_works_for_sample_data(self):
self.initialize(data, self.number_of_clusters)

0 comments on commit 106dad1

Please sign in to comment.