Hi, I'm attempting to use sklearn.ensemble.RandomForestClassifier as a regression, but when I run it, I get the following error regarding my dependent variable y:
ValueError: Unknown label type: 'continuous'
Solved! Go to Solution.
Hey, I found out why. I was using sklearn.ensemble.RandomForestClassifier, which is for categorical data. Use sklearn.ensemble.RandomForestRegressor instead, which takes floating point i.e. "continuous" values.
A similar problem has been reported here: python - ValueError: Unknown label type: 'continuous' - Stack Overflow . There are some suggestions that might help. BTW, the OP on Stack Overflow provided a lot more information.
Hey, I found out why. I was using sklearn.ensemble.RandomForestClassifier, which is for categorical data. Use sklearn.ensemble.RandomForestRegressor instead, which takes floating point i.e. "continuous" values.
Great to hear you figured out what the problem was and thanks for posting back the result.