From d9ca9b758055cbee4fa51154434e5c8018c6eee8 Mon Sep 17 00:00:00 2001 From: thocevar Date: Fri, 3 Mar 2017 13:23:19 +0100 Subject: [PATCH 1/2] KMeans: use a sample for silhouette score. --- Orange/clustering/kmeans.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orange/clustering/kmeans.py b/Orange/clustering/kmeans.py index 1bdc5cb9e80..783e1dd4d20 100644 --- a/Orange/clustering/kmeans.py +++ b/Orange/clustering/kmeans.py @@ -26,7 +26,7 @@ def fit(self, X, Y=None): proj.silhouette = np.nan try: if self._compute_silhouette and 2 <= proj.n_clusters < X.shape[0]: - proj.silhouette = silhouette_score(X, proj.labels_) + proj.silhouette = silhouette_score(X, proj.labels_, sample_size=5000) except MemoryError: # Pairwise dist in silhouette fails for large data pass proj.inertia = proj.inertia_ / X.shape[0] From 0672cfab98065eaeb40a863d3878a03670168453 Mon Sep 17 00:00:00 2001 From: thocevar Date: Fri, 3 Mar 2017 14:26:08 +0100 Subject: [PATCH 2/2] KMeans: Fix auto-commit --- Orange/widgets/unsupervised/owkmeans.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orange/widgets/unsupervised/owkmeans.py b/Orange/widgets/unsupervised/owkmeans.py index fd304a48463..6f9f7c67bf4 100644 --- a/Orange/widgets/unsupervised/owkmeans.py +++ b/Orange/widgets/unsupervised/owkmeans.py @@ -90,7 +90,7 @@ def __init__(self): layout = QGridLayout() bg = gui.radioButtonsInBox( self.controlArea, self, "optimize_k", orientation=layout, - box="Number of Clusters", callback=self.apply) + box="Number of Clusters", callback=self.invalidate) layout.addWidget( gui.appendRadioButton(bg, "Fixed:", addToLayout=False), 1, 1) sb = gui.hBox(None, margin=0)