Skip to content

Commit

Permalink
Merge pull request #60 from gmrukwa/dunn-fixes
Browse files Browse the repository at this point in the history
Release v2.5.3 - Sampled Dunn fix
  • Loading branch information
gmrukwa committed Apr 5, 2020
2 parents 2eca862 + 8c8d9db commit 301f0ec
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 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: ${{ 2 }}
FIXUP: ${{ 3 }}
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.2
docker pull gmrukwa/divik:2.5.3
```

## 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.2
pip install divik==2.5.3
```

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.2'
__version__ = '2.5.3'

from ._summary import plot, reject_split

Expand Down
2 changes: 2 additions & 0 deletions divik/_cli/fit_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def experiment(
logging.info(str(model))
data = load_data()
xy = load_xy()
# repeated dump just because the dataset locations are not tracked
dump_gin_args(destination)
model.fit(data)
save(model, destination, xy=xy)

Expand Down
6 changes: 3 additions & 3 deletions divik/score/_dunn.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ def sampled_dunn(kmeans: KMeans, data: Data,
distances = partial(_sample_distances, sampler=d, kmeans=kmeans,
inter=inter, intra=intra)
inter_, intra_ = np.array(pool.map(distances, seeds)).T
v_inter = inter_.var()
v_intra = intra_.var()
return (inter_.min() - v_inter) / (intra_.max() + v_intra)
s_inter = inter_.std()
s_intra = intra_.std()
return (inter_.min() - s_inter) / (intra_.max() + s_intra)
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.2
docker pull gmrukwa/divik:2.5.3

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

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

pip install divik==2.5.2
pip install divik==2.5.3

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.2'
__version__ = '2.5.3'

LINUX_OPTS = {
'extra_link_args': [
Expand Down
2 changes: 1 addition & 1 deletion test/score/test_dunn.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_works_with_other_distances(self):
class TestSamplingDunn(unittest.TestCase):
def setUp(self):
self.X, _ = make_blobs(n_samples=10000, n_features=2, centers=3,
random_state=0)
random_state=0, cluster_std=0.1)
self.kmeans_3 = km.KMeans(n_clusters=3).fit(self.X)
self.kmeans_7 = km.KMeans(n_clusters=7).fit(self.X)

Expand Down

0 comments on commit 301f0ec

Please sign in to comment.