Reputation: 7671
I'm trying to make a simple scikit-learn example work, but I keep getting the error: multiclass-multioutput is not supported
.
The first part of my code, which follows any basic tutorial, works as predicted:
>>> from sklearn import ensemble
>>> from sklearn import datasets
>>> dataset = datasets.load_linnerud()
>>> X, y = dataset.data, dataset.target
>>> clf = ensemble.RandomForestClassifier(n_estimators=500)
>>> clf.fit(X, y)
>>> clf.predict([X[0]])
array([[ 191., 36., 50.]])
However, when I try to get a prediction score, I get the following error:
>>> clf.score([X[0]], [y[0]])
(...)
ValueError: multiclass-multioutput is not supported
When working with datasets.load_iris()
, everything works fine. What am I doing wrong? How can I get the score of a single sample in a multivariable model?
Upvotes: 0
Views: 239
Reputation: 1018
Try swapping RandomForestRegressor
in for RandomForestClassifier
. The docs for load_linnerud()
show that it is a regression problem. Doing that made the code work for me.
Upvotes: 2