[R] How to use classwt parameter option in RandomForest
Liaw, Andy
andy_liaw at merck.com
Thu May 22 16:30:03 CEST 2008
The weights given should correspond to the ordering of levels(y) where y
contains the class labels. If in doubt, you can also give the classwt
as a named vector (e.g., classwt=c(B=3, A=2, C=1)).
Search in the R-help archive to see other options and why you probably
shouldn't use classwt.
Andy
From: Nagu
>
> Hi,
>
> I am trying to model a dataset with the response variable Y, which has
> 6 levels { Great, Greater, Greatest, Weak, Weaker, Weakest}, and
> predictor variables X, with continuous and factor variables using
> random forests in R. The variable Y acts like an ordinal variable, but
> I recoded it as factor variable.
>
> I ran a simulation and got OOB estimate of error rate 60%. I validated
> against some external datasets and got about 59% misclassification
> error. I would like to tinker with classwt option in the function
> randomForest to see if I can get a better performance the model. My
> confusion arises from how to define these weights. If I say, classwt =
> c(3,6,9,1,2,3), how exactly the levels get weighted. If this is a 6X6
> matrix, I can put a number in each cell to adjust the weights. How
> does classwt option work?
>
> Thank you in advance for any ideas.
>
> Nagu
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Notice: This e-mail message, together with any attachme...{{dropped:11}}
More information about the R-help
mailing list