-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
predict
fails for multioutput ensemble models with non-numeric DVs
#12831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is numeric-only an intentional limitation in this case? There are lines that explicitly cast to double ( scikit-learn/sklearn/ensemble/forest.py Line 279 in e73acef
|
Sorry what do you mean by "DV"? |
You're using the regressors: They are not supposed to work with classes, you want the classifiers. Can you please provide a minimum self-contained example? |
Ah, sorry. "DV" is "dependent variable". Here's an example:
Returns:
|
Thanks, this indeed looks like bug. The multi-output multi-class support is fairly untested tbh and I'm not a big fan of it (we don't implement |
For what it's worth, I think this specific issue may be resolved with a one-line fix. For my use case, having |
Feel free to submit a PR if you like |
I suspect this case is handled just fine in KNNClassifier and
DecisionTreeClassifier, so we should probably handle it here... and add
common tests.
|
Description
Multioutput forest models assume that the dependent variables are numeric. Passing string DVs returns the following error:
ValueError: could not convert string to float:
I'm going to take a stab at submitting a fix today, but I wanted to file an issue to document the problem in case I'm not able to finish a fix.
Steps/Code to Reproduce
I wrote a test based on
ensemble/tests/test_forest:test_multioutput
which currently fails:Expected Results
No error is thrown, can run
predict
for all ensemble multioutput modelsActual Results
ValueError: could not convert string to float: <DV class>
Versions
I replicated this error using the current master branch of sklearn (0.21.dev0).
The text was updated successfully, but these errors were encountered: