R caret:调整GLM boost prun参数

梅斯默

我正在尝试调整GLM提升模型的参数。根据有关此模型Caret软件包文档,有2个参数可以调整,即mstop和prune。

    library(caret)
    library(mlbench)

    data(Sonar)

    set.seed(25)
    trainIndex = createDataPartition(Sonar$Class, p = 0.9, list = FALSE)
    training = Sonar[ trainIndex,]
    testing  = Sonar[-trainIndex,]

    ### set training parameters
    fitControl = trainControl(method = "repeatedcv",
                              number = 10,
                              repeats = 10,
                              ## Estimate class probabilities
                              classProbs = TRUE,
                              ## Evaluate a two-class performances  
                              ## (ROC, sensitivity, specificity) using the following function 
                              summaryFunction = twoClassSummary)

    ### train the models
    set.seed(69)
    # Use the expand.grid to specify the search space   
    glmBoostGrid = expand.grid(mstop = c(50, 100, 150, 200, 250, 300),
                               prune = c('yes', 'no'))

    glmBoostFit = train(Class ~ ., 
                        data = training,
                        method = "glmboost",
                        trControl = fitControl,
                        tuneGrid = glmBoostGrid,
                        metric = 'ROC')
glmBoostFit

输出如下:

Boosted Generalized Linear Model 

188 samples
 60 predictors
  2 classes: 'M', 'R' 

No pre-processing
Resampling: Cross-Validated (10 fold, repeated 10 times) 
Summary of sample sizes: 169, 169, 169, 169, 170, 169, ... 
Resampling results across tuning parameters:

  mstop  ROC        Sens   Spec       ROC SD      Sens SD    Spec SD  
   50    0.8261806  0.764  0.7598611  0.10208114  0.1311104  0.1539477
  100    0.8265972  0.729  0.7625000  0.09459835  0.1391250  0.1385465
  150    0.8282083  0.717  0.7726389  0.09570417  0.1418152  0.1382405
  200    0.8307917  0.714  0.7769444  0.09484042  0.1439011  0.1452857
  250    0.8306667  0.719  0.7756944  0.09452604  0.1436740  0.1535578
  300    0.8278403  0.728  0.7722222  0.09794868  0.1425398  0.1576030

Tuning parameter 'prune' was held constant at a value of yes
ROC was used to select the optimal model using  the largest value.
The final values used for the model were mstop = 200 and prune = yes. 

Tuning parameter 'prune' was held constant at a value of yes尽管glmBoostGrid还包含,修剪参数保持常量(prune == no我查看了有关mboostboost_control方法软件包文档,并且只能mstop访问参数,那么如何prunetuneGridtrain方法参数来调整该参数呢?

phiver

区别在于glmboost的调用部分:

if (param$prune == "yes") {
    out <- if (is.factor(y)) 
        out[mstop(AIC(out, "classical"))]
    else out[mstop(AIC(out))]
}

区别在于aic的计算方式。但是在插入符中使用glmboost运行各种测试时,我怀疑它的行为是否符合预期。我在github中创建了一个问题,以查看我的怀疑是否正确。如果开发者有更多信息,我将编辑答案。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

将R Caret模型与不同的调整参数一起使用

来自分类Dev

更改由Caret在R中创建的绘图中显示的调整参数

来自分类Dev

如何使用Caret包调整多个参数?

来自分类Dev

在R中调整XGboost参数

来自分类Dev

调整Caret包中随机森林的两个参数

来自分类Dev

R中“ glm”和“ optim”之间参数的差异

来自分类Dev

如何将iPython探查器%% prun -r的结果分配给变量?

来自分类Dev

如何将iPython探查器%% prun -r的结果分配给变量?

来自分类Dev

为Boost Fusion调整空结构

来自分类Dev

为Boost Fusion调整空结构

来自分类Dev

在R(线性SVM内核)中调整svm参数

来自分类Dev

使用R中的纯游侠包进行超参数调整

来自分类Dev

使用R中的纯游侠包进行超参数调整

来自分类Dev

Boost:R树的持久存储?

来自分类Dev

在Boost R树中存储或访问对象

来自分类Dev

使用boost :: options而不给出参数值

来自分类Dev

boost :: in_place以参数作为const refs

来自分类Dev

boost :: bind()绑定额外的参数?

来自分类Dev

Boost.python自动转换参数

来自分类Dev

boost :: mpl :: fold用于双参数抽象

来自分类Dev

使用boost :: hana获取函数参数的类型

来自分类Dev

Boost :: thread thread()不接受参数

来自分类Dev

访问带有额外参数的boost变体

来自分类Dev

Boost:位置参数无法识别的选项

来自分类Dev

Boost phoenix可变参数函数解析

来自分类Dev

boost :: mpl :: fold用于双参数抽象

来自分类Dev

boost :: bind为void指针参数

来自分类Dev

boost asio acceptor.accept无效参数

来自分类Dev

将参数传递给Boost线程功能