Skip to content

Commit

Permalink
Loosen requirements on kmeans passed to DiviK
Browse files Browse the repository at this point in the history
  • Loading branch information
gmrukwa committed Feb 8, 2021
1 parent a772bed commit 6d85b20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions divik/score/_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def _dispersion(data: Data, kmeans: KMeans) -> float:
assert data.shape[0] == kmeans.labels_.size, "kmeans not fit on this data"
if kmeans.normalize_rows:
if getattr(kmeans, "normalize_rows", False):
data = normalize_rows(data)
clusters = pd.DataFrame(data).groupby(kmeans.labels_)
return float(
Expand All @@ -40,7 +40,7 @@ def _sampled_dispersion(
logging.debug(f"Sampling with seed {seed}.")
X = sampler.get_sample(seed)
logging.debug(f"Sample shape {X.shape}")
if kmeans.normalize_rows:
if getattr(kmeans, "normalize_rows", False):
logging.debug("Normalizing rows.")
X = normalize_rows(X)
if fit:
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 = "divik"
version = "3.0.7"
version = "3.0.8"
description = "Divisive iK-means algorithm implementation"
authors = ["Grzegorz Mrukwa <g.mrukwa@gmail.com>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 6d85b20

Please sign in to comment.