Closed slfan2013 closed 7 years ago
These are resolved in the devel version. A version is going to CRAN this week.
Thank you Max. If I download the developed version of caret from github, will the problem be solved?
Yes (and if you still see issues, post them here).
You can get the development version using
library(devtools)
install_github("topepo/caret/pkg/caret")
but you would have to be able to compile from source. There is a compiled version here but only for another day or so.
Hi @topepo ,
Seems that I still got same error after installing github caret_6.0-78
. For example, using bagEarthGCV
.
data = iris
control_method = "cv"
control_number = 5
control_repeats = 1
control_summaryFunction = get("multiClassSummary")
Control1 <- trainControl(method = control_method, # use N-fold cross validation
number = control_number, # the number of folds
repeats = control_repeats,
returnData = FALSE,
returnResamp = 'none',
savePredictions = "final",
classProbs = TRUE,
summaryFunction = control_summaryFunction,
allowParallel = T)
Control2 <- trainControl(method = control_method, # use N-fold cross validation
number = control_number, # the number of folds
repeats = control_repeats,
returnData = FALSE,
returnResamp = 'none',
savePredictions = "final",
classProbs = TRUE,
summaryFunction = control_summaryFunction,
allowParallel = T)
train_method = as.character(model_info$model[3])
train_metric1 = "ROC"
train_metric2 = "Accuracy"
train_tuneLength = 5
x = data[,c(1:4)]
library(doParallel)
caret::train(x, y = data[,5],
method = "bagEarthGCV",
preProcess = c("center", "scale"),
metric = train_metric2,
trControl = Control2,
tuneLength = train_tuneLength
)
Error:
Something is wrong; all the logLoss metric values are missing:
logLoss AUC prAUC Accuracy Kappa Mean_F1
Min. : NA Min. :0.5 Min. : NA Min. : NA Min. : NA Min. : NA
1st Qu.: NA 1st Qu.:0.5 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA
Median : NA Median :0.5 Median : NA Median : NA Median : NA Median : NA
Mean :NaN Mean :0.5 Mean :NaN Mean :NaN Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.:0.5 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. :0.5 Max. : NA Max. : NA Max. : NA Max. : NA
NA's :1 NA's :1 NA's :1 NA's :1 NA's :1
Mean_Sensitivity Mean_Specificity Mean_Pos_Pred_Value Mean_Neg_Pred_Value Mean_Precision
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
Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA Max. : NA Max. : NA Max. : NA
NA's :1 NA's :1 NA's :1 NA's :1 NA's :1
Mean_Recall Mean_Detection_Rate Mean_Balanced_Accuracy
Min. : NA Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA Median : NA
Mean :NaN Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA Max. : NA
NA's :1 NA's :1 NA's :1
Error: Stopping
In addition: Warning messages:
1: In train.default(x, y = data[, 5], method = train_method, preProcess = c("center", :
The metric "ROC" was not in the result set. logLoss will be used instead.
2: model fit failed for Fold1: degree=1 Error in get(ctr, mode = "function", envir = parent.frame()) :
object 'contr.earth.response' of mode 'function' was not found
3: model fit failed for Fold2: degree=1 Error in get(ctr, mode = "function", envir = parent.frame()) :
object 'contr.earth.response' of mode 'function' was not found
4: model fit failed for Fold3: degree=1 Error in get(ctr, mode = "function", envir = parent.frame()) :
object 'contr.earth.response' of mode 'function' was not found
5: model fit failed for Fold4: degree=1 Error in get(ctr, mode = "function", envir = parent.frame()) :
object 'contr.earth.response' of mode 'function' was not found
6: model fit failed for Fold5: degree=1 Error in get(ctr, mode = "function", envir = parent.frame()) :
object 'contr.earth.response' of mode 'function' was not found
7: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, :
There were missing values in resampled performance measures.
My sessionInfo is,
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats4 grid stats graphics grDevices utils datasets methods
[10] base
other attached packages:
[1] doParallel_1.0.11 iterators_1.0.8 foreach_1.4.3 wsrf_1.7.17 Rcpp_0.12.13
[6] plyr_1.8.4 party_1.2-3 strucchange_1.5-1 sandwich_2.4-0 zoo_1.8-0
[11] modeltools_0.2-21 mvtnorm_1.0-6 MLmetrics_1.1.1 caret_6.0-78 ggplot2_2.2.1.9000
[16] lattice_0.20-35 devtools_1.13.4
loaded via a namespace (and not attached):
[1] nlme_3.1-131 bitops_1.0-6 lubridate_1.7.1 dimRed_0.1.0
[5] httr_1.3.1 C50_0.1.0-24 tools_3.4.2 R6_2.2.2
[9] KernSmooth_2.23-15 rpart_4.1-11 lazyeval_0.2.1 colorspace_1.3-2
[13] nnet_7.3-12 withr_2.1.0.9000 gbm_2.1.3 tidyselect_0.2.3
[17] mnormt_1.5-5 klaR_0.6-12 curl_3.0 compiler_3.4.2
[21] git2r_0.19.0 glmnet_2.0-13 pacman_0.4.6 caTools_1.17.1
[25] scales_0.5.0.9000 sfsmisc_1.1-1 DEoptimR_1.0-8 psych_1.7.8
[29] robustbase_0.92-8 plotmo_3.3.4 stringr_1.2.0 digest_0.6.12
[33] foreign_0.8-69 pkgconfig_2.0.1 plotrix_3.6-6 RWekajars_3.9.1-4
[37] rlang_0.1.4 ddalpha_1.3.1 VGAM_1.0-4 bindr_0.1
[41] combinat_0.0-8 gtools_3.5.0 dplyr_0.7.4 ModelMetrics_1.1.0
[45] magrittr_1.5 Formula_1.2-2 Matrix_1.2-11 munsell_0.4.3
[49] RWeka_0.4-35 partykit_1.1-1 stringi_1.1.5 multcomp_1.4-8
[53] rpartScore_1.0-1 MASS_7.3-47 gplots_3.0.1 recipes_0.1.1
[57] gdata_2.18.0 earth_4.5.1 splines_3.4.2 knitr_1.17
[61] xgboost_0.6-4 reshape2_1.4.2 codetools_0.2-15 CVST_0.2-1
[65] glue_1.2.0 data.table_1.10.4-3 mlbench_2.1-1 bst_0.3-14
[69] gtable_0.2.0 purrr_0.2.4 tidyr_0.7.2 kernlab_0.9-25
[73] assertthat_0.2.0 TeachingDemos_2.10 DRR_0.0.2 gower_0.1.2
[77] coin_1.2-1 prodlim_1.6.1 broom_0.4.2 e1071_1.6-8
[81] class_7.3-14 survival_2.41-3 timeDate_3042.101 RcppRoll_0.2.2
[85] tibble_1.3.4 rJava_0.9-9 memoise_1.1.0 bindrcpp_0.2
[89] lava_1.5.1 RSNNS_0.4-9 TH.data_1.0-8 ROCR_1.0-7
[93] ipred_0.9-6
I didn't realize that earth
's generalized linear model code could use more than two classes. I'll look into this more now that I've done an initial update to these models.
Please try using these changes and verify that it solves the issue.
Thank you @topepo .
The bagEarthGCV
is working! However, blackboost
is not working and same issue (all NA's). Let me run all the method and I'll let you know which methods are having this error.
Thanks again.
The warnings from blackboost
say
family = Multinomial()
only works with Kronecker prodcut base-learners, i.e., combined base-learners of the formbl1 %O% bl2
fitted viagamboost()
ormboost()
. See ‘?Multinomial’ for details.
I interpret this as saying that it doesn't work for these data.
Linear or additive multinomial logit models can be fitted using
Multinomial()
; although is family requires some extra effort for model specification (see example). More specifically, the predictor must be in the form of a linear array model (see%O%
). Note that this family does not work with tree-based base-learners at the moment. The class corresponding to the last level of the factor coding of the response is used as reference class.
Several methods, e.g. "plor", "gcvEarth","bagEarthGCV","bag","blackboost" etc, return the same problem.
Error:
Something is wrong; all the logLoss metric values are missing.
Warning:2: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, : There were missing values in resampled performance measures.
Code:The output is
My sessionInfo is: