简体   繁体   中英

caret - error - Something is wrong - all the ROC metric values are missing:

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. Eg - the first call per below works, the second call gives an error. i have had similar issue when i included eg the Verbose argument, keeping all things equal, or when i run specific packages in caret (eg 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, eg (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))

我遇到了类似的问题,发现在培训之前加载pROC库( https://cran.r-project.org/web/packages/pROC/index.html )就可以解决问题。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM