[R] NAs error in caret function

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Wed Apr 20 22:25:51 CEST 2022


A quick web search on 'R caret package' found a host of useful
results, the first of which was this:
https://topepo.github.io/caret/
Note that the author, Max Kuhn, explicitly says there that you can
email him with questions. I think you should do so, as you do not seem
to be making progress here.

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Wed, Apr 20, 2022 at 12:51 PM javed khan <javedbtk111 using gmail.com> wrote:
>
> Caret produce the error: Something is wrong; all the Accuracy metric values
> are missing:
>     logLoss         AUC          prAUC        Accuracy       Kappa
>  Min.   : NA   Min.   : NA   Min.   : NA   Min.   : NA   Min.   : NA
>  1st Qu.: NA   1st Qu.: NA   1st Qu.: NA   1st Qu.: NA   1st Qu.: NA
>  Median : NA   Median : NA   Median : NA   Median : NA   Median : NA
>
> We (group of three) working on an assignment and could not fix this error
> from a few days. The error comes with the majority of the models while with
> a few model (e.g. nb), the code works. The data is text-based
> classification.
>
> Some Warnings are:
>
> Warning messages:
> 1: In train.default(y = train_label, x = train_x, method = "pls",  ... :
>   The metric "ROC" was not in the result set. logLoss will be used instead.
> 2: model fit failed for Fold01.Rep1: ncomp=3 Error in
> `[[<-.data.frame`(`*tmp*`, i, value = structure(c(1L, 1L, 1L,  :
>   replacement has 320292 rows, data has 1148
>
> 3: model fit failed for Fold02.Rep1: ncomp=3 Error in
> `[[<-.data.frame`(`*tmp*`, i, value = structure(c(1L, 1L, 1L,  :
>   replacement has 320013 rows, data has 1147
>
> 4: model fit failed for Fold03.Rep1: ncomp=3 Error in
> `[[<-.data.frame`(`*tmp*`, i, value = structure(c(1L, 1L, 1L,  :
>   replacement has 320013 rows, data has 1147
>
> 5: model fit failed for Fold04.Rep1: ncomp=3 Error in
> `[[<-.data.frame`(`*tmp*`, i, value = structure(c(1L, 1L, 1L,  :
>   replacement has 320292 rows, data has 1148
>
> 6: model fit failed for Fold05.Rep1: ncomp=3 Error in
> `[[<-.data.frame`(`*tmp*`, i, value = structure(c(1L, 1L, 1L,  :
>   replacement has 320013 rows, data has 1147
>
> 7: model fit failed for Fold06.Rep1: ncomp=3 Error in
> `[[<-.data.frame`(`*tmp*`, i, value = structure(c(1L, 1L, 1L,  :
>   replacement has 320013 rows, data has 1147
>
>
>
> Code is
>
>
> m= train(y = train_label, x = train_x,
>       method = "pls" ,
>       metric = "Accuracy",
>       ## #  preProc = c("center", "scale", "nzv"),
>       trControl = ctrl)
>
> p=predict(m, test_x)
> confusionMatrix(p, as.factor(test_label))
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org 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.



More information about the R-help mailing list