From 4ccfe2f4aa1805b3cb8c0956f6a2d0332d0d1158 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 29 Sep 2018 23:11:45 -0500 Subject: [PATCH] Prediction label retrieval should be moved to after the first fit call --- sklearn/utils/estimator_checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/utils/estimator_checks.py b/sklearn/utils/estimator_checks.py index 54369033a75d3..d886c7dff8f1e 100644 --- a/sklearn/utils/estimator_checks.py +++ b/sklearn/utils/estimator_checks.py @@ -1290,10 +1290,10 @@ def check_clustering(name, clusterer_orig, readonly_memmap=False): # fit clusterer.fit(X) + pred = clusterer.labels_ # with lists clusterer.fit(X.tolist()) - pred = clusterer.labels_ assert_equal(pred.shape, (n_samples,)) assert_greater(adjusted_rand_score(pred, y), 0.4) # fit another time with ``fit_predict`` and compare results