[R] RandomForest question
andy_liaw at merck.com
Thu Jul 21 16:16:43 CEST 2005
> From: Arne.Muller at sanofi-aventis.com
> I'm trying to find out the optimal number of splits (mtry
> parameter) for a randomForest classification. The
> classification is binary and there are 32 explanatory
> variables (mostly factors with each up to 4 levels but also
> some numeric variables) and 575 cases.
> I've seen that although there are only 32 explanatory
> variables the best classification performance is reached when
> choosing mtry=80. How is it possible that more variables can
> used than there are in columns the data frame?
It's not. The code for randomForest.default() has:
## Make sure mtry is in reasonable range.
mtry <- max(1, min(p, round(mtry)))
so it silently sets mtry to number of predictors if it's too large.
As an example:
Type rfNews() to see new features/changes/bug fixes.
> iris.rf = randomForest(Species ~ ., iris, mtry=10)
I should probably add a warning in such cases...
> thanks for your help
> + kind regards,
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help