插入符号R中的bagEarth方法缺少所有RMSE值

时间:2017-03-02 17:26:46

标签: r r-caret mars

我正在尝试完成应用预测建模(Max Kuhn)第7章的练习3,它使用了袋装MARS模型。我正在使用的代码直接来自这里找到的解决方案: Chapter 7 Solutions

然而,当我训练bagEarth模型时:

meatBMARS <- train(x = absorpTrain, y = proteinTrain,
+                     method = "bagEarth",
+                     trControl = ctrl,
+                     tuneLength = 25,
+                     B = 20)

我收到错误:

     Something is wrong; all the RMSE metric values are missing:
          RMSE        Rsquared  
     Min.   : NA   Min.   : NA  
     1st Qu.: NA   1st Qu.: NA  
     Median : NA   Median : NA  
     Mean   :NaN   Mean   :NaN  
     3rd Qu.: NA   3rd Qu.: NA  
     Max.   : NA   Max.   : NA  
     NA's   :25    NA's   :25   
    Error in train.default(x = absorpTrain, y = proteinTrain, method = "bagEarth",  : 
      Stopping
    In addition: There were 50 or more warnings (use warnings() to see the first 50)
    > warnings()
    Warning messages:
    1: In eval(expr, envir, enclos) :
      predictions failed for Fold01.Rep1: degree=1, nprune=32 Error in eval(expr, envir, enclos) : 
      could not find function "bagEarth.default"

    2: In eval(expr, envir, enclos) :
      predictions failed for Fold02.Rep1: degree=1, nprune=32 Error in eval(expr, envir, enclos) : 
      could not find function "bagEarth.default"

    3: In eval(expr, envir, enclos) :
      predictions failed for Fold03.Rep1: degree=1, nprune=32 Error in eval(expr, envir, enclos) : 
      could not find function "bagEarth.default"

    4: In eval(expr, envir, enclos) :
      predictions failed for Fold04.Rep1: degree=1, nprune=32 Error in eval(expr, envir, enclos) : 
      could not find function "bagEarth.default
...

正在训练的数据是来自插入符号包的tecator数据,分为训练和测试集:

> data(tecator)
> set.seed(1029)
> inMeatTraining <- createDataPartition(endpoints[, 3], p = 3/4, list= FALSE)
> absorpTrain <- absorp[ inMeatTraining,]
> absorpTest  <- absorp[-inMeatTraining,]
> proteinTrain <- endpoints[ inMeatTraining, 3]
> proteinTest  <- endpoints[-inMeatTraining,3]
> ctrl <- trainControl(method = "repeatedcv", repeats = 5)

有关数据集的更多信息:

> str(absorpTrain)
 num [1:163, 1:100] 2.62 2.83 2.82 2.79 3.01 ...
> str(proteinTrain)
 num [1:163] 16.7 13.5 20.7 15.5 13.7 13.7 19.3 17.7 17.7 12.5 ...

我已经安装并加载了地球包,所以我不确定为什么会发生这种情况。

非常感谢任何建议。

0 个答案:

没有答案