I have discrete values in the target variable(Exactly 13 different values in total) . When I am giving that as input to Random forest Classifier ,it gives error that input as continuous. And if I give it to regressor it is predicting a value between the discrete values. How can I treat this problem
I suspect the problem is that your discrete values are non-integer floats. The classifier's fit method runs
type_of_target, which returns (in part):
yis an array-like of floats that are not all integers, and is 1d or a column vector.
(Tracing the source code wasn't straightforward; a traceback of the error from you would have been helpful. For reference here, RandomForestClassifier inherits from BaseForest, whose fit method calls
_validate_y_class_weight which (in the ForestClassifier child class) calls
check_classification_targets which calls