How to get Mean Magnitude of Relative Error with caret library

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to get Mean Magnitude of Relative Error with caret library

NehaBologna
Hi, I am using caret package and using nested resampling method (i.e. 5
fold for outer fold). I am getting the RMSE and MAE values, which are
default to the caret library.
My question is how can we implement the Mean Magnitude of Relative Error
(MRE and MMRE) with caret. My code is the following:

outer_folds <- createFolds(d$price, k = 5)
boot <- trainControl(method = "boot", number=100)

CV1 <- lapply(outer_folds, function(index){
  tr <- d[-index, ]
  ts <- d[index,]

  cart1 <- train(bug ~ ., data = tr,
                  method = "rf",
                 metric = "MAE",
                 preProc = c("center", "scale", "nzv"),
                 trControl = boot)

  postResample(predict(cart1, ts), ts$price)
})
sapply(CV1, function(x) x[3]) -> CV_MAE1
CV_MAE1

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.