1
$\begingroup$

I have a classification problem where my dependent variable has 3 possible values. They are ordered variables.

I have been using trees and random forests in R to tackle this problem, but have to convert the problem into a binary one, so i'm predicting if the dependent variable is or isn't 1, then is or isn't 2, then is or isn't 3 in 3 different models.

Can I build a random forest or decision tree with an ordinal variable as the dependent variable?

Are there any better ways I should be approaching this problem?

Thanks

$\endgroup$
1
$\begingroup$

I know that randomForest in R, at least, will handle 3 level categorical variables just fine. You could also do 1 vs other and 2 vs 3; you'd only need 2 models. But I'm not sure if this makes a difference.

$\endgroup$
2
$\begingroup$

With the OneR package (which basically builds a one level tree with the best predictor) you can have any number of levels in all input variables and in the output variable:

https://cran.r-project.org/web/packages/OneR/vignettes/OneR.html

(Full disclosure: I am the author of this package)

$\endgroup$
  • 1
    $\begingroup$ This works really well. I wished something with the same interface would exist for multi-level trees. $\endgroup$ – graup Mar 26 '18 at 14:50
  • $\begingroup$ @graup: Thank you for the great feedback - I really appreciate that! $\endgroup$ – vonjd Mar 26 '18 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.