1

i am using the caret package. At specific instances, as for example, but not exclusively per the example below, caret will produce the following error:

Something is wrong; all the ROC metric values are missing:
Error in train.default(x, y, weights = w, ...) : Stopping

The strange thing is that caret might do this with nearly identical calls. E.g. - the first call per below works, the second call gives an error. i have had similar issue when i included e.g. the Verbose argument, keeping all things equal, or when i run specific packages in caret (e.g. SVMs).

I have read that the issue might be definition of the class variable, but my main variable is a standard factor with 2 levels, e.g. (Factor w/ 2 levels "NP","P": 1 1 1 1 1 1 1 1 1 1 ...).

Does anyone have any tips?

(apologies for not including reproducible example)

Call 1
gbmFit1 <- train(class ~., data = dt_fulltrain,method = "gbm",metric="ROC",trControl = fitControl)

Call2
gbmFit1 <- train(class ~., data = dt_fulltrain,method = "gbm",metric="ROC",trControl = fitControl, strata = dt_fulltrain$class, sampsize = rep(nmin, 2))
smci
  • 32,567
  • 20
  • 113
  • 146
user1885116
  • 1,757
  • 4
  • 26
  • 39
  • Rather than apologizing for not having a reproducible example, please take the time to [create a reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). We need to see exactly what you are passing to the function. – MrFlick Jun 16 '15 at 18:05

2 Answers2

4

I've had a similar problem and found that loading the pROC library (https://cran.r-project.org/web/packages/pROC/index.html) before training solves the issue.

KaanKaant
  • 434
  • 3
  • 16
0

I had a similar problem. Without having a reproducible version of yours, I can't be sure that this will solve it.

For future readers, however, you might try checking your data for NA, NaN, and Inf. In my case, I had some cells that contained Inf. Removing those rows, solved the problem.

Anaxagoras
  • 39
  • 3