Skip to content

Commit

Permalink
Add size check before trying to split for GMeans (#732)
Browse files Browse the repository at this point in the history
* Add size check before trying to split

* Rebase to new code

Co-authored-by: chico <[email protected]>
  • Loading branch information
pberba and franchuterivera authored Feb 24, 2021
1 parent b66d2c7 commit d3aa95e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions autosklearn/metalearning/metalearning/clustering/gmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def fit(self, X):
indices = KMeans.labels_ == i
X_ = X[indices]

if np.sum(indices) < self.minimum_samples_per_cluster*2:
cluster_centers.append(cluster_center)
continue

for i in range(10):
KMeans_ = sklearn.cluster.KMeans(n_clusters=2,
n_init=self.n_init,
Expand Down

0 comments on commit d3aa95e

Please sign in to comment.