I've got a dependent variable in R with about 11,000 class levels. There's ample data for modeling this many classes, however some statistical packages like h2o only support up to 1,000 classes or so.

What are the best options for classification models in R with this high number of class levels?


Cluster your n response classes into m clusters, where m < 1,000. With an incoming instance i assign it to one of the m clusters using your favorite classification algorithm. Once the instance has been assigned to a specific cluster, you just need to run it through a classifier trained on the classes that comprise that particular cluster.

I've used this particular architecture to assign texts to one of n possible "emotions", which I illustrate below. The incoming text was first scored with a binary classifier trained on positive & negative texts. Given the text's probability of being positive (as predicted by the classifier), the text was then routed to either a series of all positive or a series of all negative emotion classifiers where it was a assigned a specific emotion.

enter image description here

This same sort of design should work your case. First you assign your instance a cluster. Given that assignment, send your instance to the next stage - where the final classification occurs.

  • $\begingroup$ Sorry if this description is murky - its surprisingly hard to describe this - does anybody know if there is a design pattern name for this type of ensemble? $\endgroup$ – Brandon Loudermilk May 13 '16 at 23:38
  • $\begingroup$ I have a similar problem I'm working on right now. It's not unlike taking the groups from the first level of a regression tree, then taking the data that fall into those groups, and running a separate model depending on which group it falls into. I'm definitely lacking the vocabulary here. I just want to take the first two turns of Guess Who, not play the whole game ... $\endgroup$ – rbatt May 15 '16 at 0:53

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.