5353from sklearn .exceptions import DataConversionWarning
5454
5555from sklearn .pipeline import Pipeline
56- from sklearn .cross_validation import cross_val_score
57- from sklearn .cross_validation import LeaveOneOut
56+ from sklearn .cross_validation import cross_val_predict
5857from sklearn .svm import SVR
5958
6059from sklearn import datasets
@@ -1379,7 +1378,7 @@ def test_cv_pipeline_precomputed():
13791378 value. Use precomputed kernel to ensure Pipeline with KernelCenterer
13801379 is treated as a _pairwise operation."""
13811380 X = np .array ([[3 ,0 ,0 ],[0 ,3 ,0 ],[0 ,0 ,3 ],[1 ,1 ,1 ]])
1382- y = np .ones ((4 ,))
1381+ y_true = np .ones ((4 ,))
13831382 K = X .dot (X .T )
13841383 kcent = KernelCenterer ()
13851384 pipeline = Pipeline ([("kernel_centerer" , kcent ), ("svr" , SVR ())])
@@ -1388,8 +1387,10 @@ def test_cv_pipeline_precomputed():
13881387 assert_true (pipeline ._pairwise )
13891388
13901389 # test cross-validation, score should be almost perfect
1391- score = cross_val_score (pipeline ,K ,y ,cv = LeaveOneOut (4 ))
1392- assert_array_almost_equal (score , np .ones_like (score ))
1390+ # NB: this test is pretty vacuous -- it's mainly to test integration
1391+ # of Pipeline and KernelCenterer
1392+ y_pred = cross_val_predict (pipeline ,K ,y_true ,cv = 4 )
1393+ assert_array_almost_equal (y_true , y_pred )
13931394
13941395
13951396def test_fit_transform ():
0 commit comments