我在一个大数据问题中使用随机森林,它有一个非常不平衡的响应类,所以我阅读了文档,发现了以下参数:
strata
sampsize
这些参数的文档很少(或者我没有运气找到它)而且我真的不明白如何实现它。我正在使用以下代码:
randomForest(x=predictors,
y=response,
data=train.data,
mtry=lista.params[1],
ntree=lista.params[2],
na.action=na.omit,
nodesize=lista.params[3],
maxnodes=lista.params[4],
sampsize=c(250000,2000),
do.trace=100,
importance=TRUE)
响应是具有两个可能值的类,第一个比第二个出现的频率更高(10000:1 或更多)
这list.params
是一个具有不同参数的列表(呃!我知道......)
好吧,问题(再次)是:我如何使用'strata'参数?我正确使用 sampsize 吗?
最后,有时我会收到以下错误:
Error in randomForest.default(x = predictors, y = response, data = train.data, :
Still have fewer than two classes in the in-bag sample after 10 attempts.
对不起,如果我做了这么多(也许是愚蠢的)问题......