[R] RandomForest how to identify two classes when only one is present

JMark bjmethari at gmail.com
Thu Apr 8 19:18:07 CEST 2010


I'm trying to do:
randomForest(f, data = moths.train)

But I get this error:
Error in randomForest.default(m, y, ...) : 
  Need at least two classes to do classification.

When I look at the data for this, I realize there are no positive cases of
this item:
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
 [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
 [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
[112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
[149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
Levels: 0

Is there a way to show RandomForest that both 0 and 1 are possible and run
randomForest?

Thanks
-- 
View this message in context: http://n4.nabble.com/RandomForest-how-to-identify-two-classes-when-only-one-is-present-tp1774388p1774388.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list