随机森林的特征选择和参数调整
机器算法验证
回归
特征选择
随机森林
插入符号
2022-03-28 05:46:38
2个回答
您可能想要研究的一件事是正则化随机森林,它专为特征选择而设计。本文解释了这个概念,以及它们与普通随机森林的区别
还有一个基于 randomForest 的 CRAN 包RRF,它可以让您在 R 中轻松实现它们。我自己对这种方法很幸运。
关于你最初的问题,我能给出的唯一建议是,如果你有很多共线性,那么你需要使用更小的树大小。这允许算法确定重要性,而共线性效应的干扰较少。
您也许可以使用这样的caretFuncs
东西:
myRFE <- caretFuncs
myRFE$summary <- twoClassSummary (default is defaultSummary)
rctrl <- rfeControl(method='repeatedcv', repeats=5, number=10,
functions=myRFE)
tctrl <- trainControl(method = "cv",
classProbs = TRUE,
summaryFunction = twoClassSummary)
rfeObj = rfe(x,y,sizes=seq(1,ncol(x),2),
rfeControl=rctrl,
# to be passed to train()
method='rf',
importance=T, # do not forget this
ntree=1000,
metric = "ROC",
tuneLength = 10,
# mtry=c(1,3,5,50),
# specify the exact mtry, or tuneLength
# can auto truncate the grid to minimal sizes (with or without warning)
# p <- ncol(x) ... if (mtry < 1 || mtry > p) warning("invalid try: reset to within valid range") try <- max(1, min(p, round(try)))
trControl=tctrl)
此外,还可以检查valSelRF
包裹。不知道它与regularized random forest
这里提到的有什么不同。
其它你可能感兴趣的问题