我正在使用R软件包的boosting对10,000×932的一些生物数据进行回归,我想知道GBM软件包的最佳参数设置是什么(n.trees,收缩,interaction.depth和n.minobsinnode)当我在网上搜索时,我发现R上的CARET软件包可以找到这样的参数设置。但是,我很难将Caret包与GBM包一起使用,所以我只想知道如何使用脱字符来找到前面提到的参数的最佳组合?我知道这个问题可能看起来很典型,但我读了插入符号手册,仍然很难将插入符号与gbm集成,特别是因为我对这两个包都是非常陌生的
发布于 2013-03-26 16:35:11
这个链接有一个具体的例子(第10页)-- http://www.jstatsoft.org/v28/i05/paper
基本上,首先应该为超参数(如n.trees、interaction.depth和收缩)创建候选值的网格。然后像往常一样调用通用的训练函数。
发布于 2016-06-06 09:20:40
我不确定你是否找到了你想要的东西,但我发现这些表格中的一些没有什么帮助。
如果您使用的是脱字符软件包,下面描述了所需的参数:> getModelInfo()$gbm$parameters
他有一些运行GBM的经验法则:
使用插入符号包的示例设置:
getModelInfo()$gbm$parameters
library(parallel)
library(doMC)
registerDoMC(cores = 20)
# Max shrinkage for gbm
nl = nrow(training)
max(0.01, 0.1*min(1, nl/10000))
# Max Value for interaction.depth
floor(sqrt(NCOL(training)))
gbmGrid <- expand.grid(interaction.depth = c(1, 3, 6, 9, 10),
n.trees = (0:50)*50,
shrinkage = seq(.0005, .05,.0005),
n.minobsinnode = 10) # you can also put something like c(5, 10, 15, 20)
fitControl <- trainControl(method = "repeatedcv",
repeats = 5,
preProcOptions = list(thresh = 0.95),
## Estimate class probabilities
classProbs = TRUE,
## Evaluate performance using
## the following function
summaryFunction = twoClassSummary)
# Method + Date + distribution
set.seed(1)
system.time(GBM0604ada <- train(Outcome ~ ., data = training,
distribution = "adaboost",
method = "gbm", bag.fraction = 0.5,
nTrain = round(nrow(training) *.75),
trControl = fitControl,
verbose = TRUE,
tuneGrid = gbmGrid,
## Specify which metric to optimize
metric = "ROC"))事情可能会根据你的数据而改变(比如分布),但我发现关键是尝试gbmgrid,直到你得到你想要的结果。现在的设置需要很长时间才能运行,因此请根据您的机器进行修改,时间允许。为了给你一个大概的计算空间,我在64 12内存的Mac PRO 12内核上运行。
https://stackoverflow.com/questions/15613332
复制相似问题