Skip to content

Commit

Permalink
Merge pull request #184 from torlarse/bug_map_precomputed
Browse files Browse the repository at this point in the history
Enable using precomputed distance matrices for clustering.
  • Loading branch information
Nathaniel Saul authored Nov 25, 2019
2 parents 0711d80 + 2ccce2d commit 4c52847
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions kmapper/kmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,17 +500,19 @@ def map(
# we consider clustering or skipping it.
cluster_params = clusterer.get_params()

min_cluster_samples = cluster_params.get(
"n_clusters",
cluster_params.get(
"min_cluster_size", cluster_params.get("min_samples", 1)
),
)
if precomputed:
min_cluster_samples = 2
else:
min_cluster_samples = cluster_params.get(
"n_clusters",
cluster_params.get(
"min_cluster_size", cluster_params.get("min_samples", 1)
),
)

if self.verbose > 1:
print(
"Minimal points in hypercube before clustering: %d"
% (min_cluster_samples)
"Minimal points in hypercube before clustering: {}".format(min_cluster_samples)
)

# Subdivide the projected data X in intervals/hypercubes with overlap
Expand Down

0 comments on commit 4c52847

Please sign in to comment.