You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An error is thrown when using Random forest classifier multi-target non-numeric classes #11451
Random forest classifier can be fit on multiple target columns where columns have string labels and are not numeric, but when trying to predict, an error is thrown.
File ".../local/lib/python2.7/site-packages/sklearn/ensemble/forest.py", line 550, in predict
axis=0)
ValueError: could not convert string to float: foo
Activity
mitar commentedon Jul 6, 2018
It seems the following code fixes the problem:
jnothman commentedon Jul 7, 2018
mitar commentedon Jul 7, 2018
I mean, the code above looks like you are trying to support. Otherwise there would be no
self.classes_[k].takethere, no?I can make a pull request. Is the example solution OK? Going through a list and not pre-allocate?
jnothman commentedon Jul 7, 2018
Fixes tree and forest classification for non-numeric multi-target.
mitar commentedon Jul 8, 2018
Pull request with tests made: #11458
mitar commentedon Jul 8, 2018
While fixing this, I searched a code a bit for similar (bad) pattern and found out that trees also do not work. So I fixed them as well.
Fixes tree and forest classification for non-numeric multi-target.
FIX Fixes tree and forest classification for non-numeric multi-target (…
FIX Fixes tree and forest classification for non-numeric multi-target (…
FIX Fixes tree and forest classification for non-numeric multi-target (…