@@ -42,12 +42,15 @@ def score(self, X=None, Y=None
F9CF
):
42
42
def test_grid_search ():
43
43
"""Test that the best estimator contains the right value for foo_param"""
44
44
clf = MockClassifier ()
45
- cross_validation = GridSearchCV (clf , {'foo_param' : [1 , 2 , 3 ]})
45
+ grid_search = GridSearchCV (clf , {'foo_param' : [1 , 2 , 3 ]})
46
46
# make sure it selects the smallest parameter in case of ties
47
- assert_equal (cross_validation .fit (X , y ).best_estimator_ .foo_param , 2 )
47
+ grid_search .fit (X , y )
48
+ assert_equal (grid_search .best_estimator_ .foo_param , 2 )
48
49
49
50
for i , foo_i in enumerate ([1 , 2 , 3 ]):
50
- assert cross_validation .grid_scores_ [i ][0 ] == {'foo_param' : foo_i }
51
+ assert grid_search .grid_scores_ [i ][0 ] == {'foo_param' : foo_i }
52
+ # Smoke test the score:
53
+ grid_search .score (X , y )
51
54
52
55
53
56
def test_grid_search_error ():
@@ -101,6 +104,9 @@ def test_grid_search_sparse_score_func():
101
104
102
105
assert_array_equal (y_pred , y_pred2 )
103
106
assert_equal (C , C2 )
107
+ # Smoke test the score
108
+ #np.testing.assert_allclose(f1_score(cv.predict(X_[:180]), y[:180]),
109
+ # cv.score(X_[:180], y[:180]))
104
110
105
111
106
112
class BrokenClassifier (BaseEstimator ):
0 commit comments