Reputation: 31
I want to do a multilabel classification with R randomForest. I have ten classes A..J,
I found examples how to predict a single class, like:
r = randomForest(J ~., data=train, importance=TRUE, do.trace=100)
But I want to predict more classes, for instance H,I,J. (i.e. say that only A..G are given attributes). How can I do it?
I have an idea of preserving A..G and only one of the predicted classes (H/I/J) and run randomForest 3 times, but maybe there is a better way? To do it in one run?
Many thanks in advance.
Upvotes: 3
Views: 1909
Reputation: 637
Let's say that all attributes H, I and J are binary. Then you can just predict a new attribute K with 2^3 possible values and then decode the result back into 3 attributes:
Upvotes: 2