Skip to content

Commit

Permalink
add rewrite of minimal cluster sampling in order to allow precomputed…
Browse files Browse the repository at this point in the history
… distance matrices. This fixes crash when using clustering distance treshold, which is without a fixed number of clusters.
  • Loading branch information
holmbuar committed Nov 25, 2019
1 parent 0711d80 commit 2ccce2d
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 2ccce2d

Please sign in to comment.