[R] RandomForest how to identify two classes when only one is present
Steve Lianoglou
mailinglist.honeypot at gmail.com
Thu Apr 8 23:45:17 CEST 2010
Hi,
On Thu, Apr 8, 2010 at 1:18 PM, JMark <bjmethari at gmail.com> wrote:
>
> 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?
Even if both 0 and 1 are "possible," you are not giving it any
examples of the opposite class ... what do you expect it to learn?
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list