Reputation: 1838
I have a very simple pandas DataFrame (X), with eight columns, and twenty rows full of floats. Then, I have another DataFrame (y), that is twenty rows. When I run:
score = cross_val_score(clf, X, y, scoring='accuracy')
I get no error and the results make sense (there is nothing wrong with the DataFrame, basically). However, when I run:
predicted = cross_val_predict(clf, X)
or
predicted = cross_val_predict(clf, X.values)
I get the following error:
Expected array-like (array or non-string sequence), got None
Any suggestions as to what the problem might be?
Upvotes: 0
Views: 855
Reputation: 2056
Since you are dealing with a supervised learning problem, you should also provide y
as an argument to cross_val_predict
, i.e., cross_val_predict(clf, X,y)
. This is necessary, as k fold cross-validation requires training the classifier for multiple training sets.
Upvotes: 2