sbearben
sbearben

Reputation: 323

All RMSE values missing for bagEarth method in caret R

I'm trying to complete Exercise 3 from Chapter 7 of Applied Predictive Modeling (Max Kuhn), which uses a bagged MARS model. The code I'm using is straight from the solutions found here: Chapter 7 Solutions

However, when I train the bagEarth model:

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

I get the error:

     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
...

The data being trained is the tecator data from the caret package, divided into training and test sets:

> 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)

More info on the dataset:

> 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 ...

I have the earth package installed and loaded, so I'm not sure why this is happening.

Any advice would be much appreciated.

Upvotes: 1

Views: 409

Answers (0)

Related Questions