# Buggy code
def update_results(self):
    scores = [
        mk if isinstance(mk, str) else silhouette_score(self.data.X, mk.labels)
        for mk in (self.clusterings[k] for k in range(self.k_from, self.k_to + 1))
    ]
    best_row = max(
        range(len(scores)),
        default=0,
        key=lambda x: 0 if isinstance(scores[x], str) else scores[x],
    )
    self.table_model.set_scores(scores, self.k_from)
    self.table_view.selectRow(best_row)
    self.table_view.setFocus(Qt.OtherFocusReason)
    self.table_view.resizeRowsToContents()


# Traceback (ValueError)
---------------------------- ValueError Exception -----------------------------
Traceback (most recent call last):
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Orange/widgets/unsupervised/owkmeans.py", line 322, in __commit_finished
self.update_results()
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Orange/widgets/unsupervised/owkmeans.py", line 438, in update_results
self.clusterings[k] for k in range(self.k_from, self.k_to + 1))]
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Orange/widgets/unsupervised/owkmeans.py", line 437, in <listcomp>
self.data.X, mk.labels) for mk in (
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/metrics/cluster/unsupervised.py", line 117, in silhouette_score
return np.mean(silhouette_samples(X, labels, metric=metric, **kwds))
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/metrics/cluster/unsupervised.py", line 212, in silhouette_samples
X, labels = check_X_y(X, labels, accept_sparse=['csc', 'csr'])
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/validation.py", line 719, in check_X_y
estimator=estimator)
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/validation.py", line 542, in check_array
allow_nan=force_all_finite == 'allow-nan')
File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/validation.py", line 56, in _assert_all_finite
raise ValueError(msg_err.format(type_err, X.dtype))
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
-------------------------------------------------------------------------------

# Fixed code
def update_results(self):
    scores = [
        mk
        if isinstance(mk, str)
        else silhouette_score(self.preproces(self.data).X, mk.labels)
        for mk in (self.clusterings[k] for k in range(self.k_from, self.k_to + 1))
    ]
    best_row = max(
        range(len(scores)),
        default=0,
        key=lambda x: 0 if isinstance(scores[x], str) else scores[x],
    )
    self.table_model.set_scores(scores, self.k_from)
    self.table_view.selectRow(best_row)
    self.table_view.setFocus(Qt.OtherFocusReason)
    self.table_view.resizeRowsToContents()