predict.train No longer exported from caret package
Closed this issue · 1 comments
ray-p144 commented
As of this commit on the master
branch of the caret
package, the predict.train
function is no longer exported causing the following error to be thrown from predict.caretList
:
Error: 'predict.train' is not an exported object from 'namespace:caret'
Minimal, reproducible example:
Minimal dataset:
set.seed(1)
dat <- caret::twoClassSim(100)
X <- dat[,1:5]
y <- dat[["Class"]]
Minimal, runnable code:
library(caretEnsemble)
models <- caretList(
X, y,
methodList=c('glm', 'rpart'),
trControl=trainControl(
method="cv",
number=5,
classProbs=TRUE,
savePredictions="final")
)
predict(models, newdata = X)
Session Info:
>sessionInfo()
R version 3.4.3 (2017-11-30)
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 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] caretEnsemble_2.0.0 caret_6.0-79 ggplot2_2.2.1.9000 lattice_0.20-35 RevoUtils_10.0.7 RevoUtilsMath_10.0.1
loaded via a namespace (and not attached):
[1] tidyselect_0.2.3 pbapply_1.3-3 purrr_0.2.4 reshape2_1.4.3 kernlab_0.9-25 splines_3.4.3 colorspace_1.3-2
[8] stats4_3.4.3 yaml_2.1.16 survival_2.41-3 prodlim_1.6.1 rlang_0.2.0.9000 e1071_1.6-8 ModelMetrics_1.1.0
[15] pillar_1.0.1 withr_2.1.1.9000 foreign_0.8-69 glue_1.2.0 bindrcpp_0.2 foreach_1.4.5 bindr_0.1
[22] plyr_1.8.4 dimRed_0.1.0 lava_1.5.1 robustbase_0.92-8 stringr_1.2.0 timeDate_3042.101 munsell_0.4.3
[29] gtable_0.2.0 recipes_0.1.1 codetools_0.2-15 psych_1.7.8 parallel_3.4.3 class_7.3-14 DEoptimR_1.0-8
[36] broom_0.4.3 Rcpp_0.12.14 scales_0.5.0.9000 ipred_0.9-6 CVST_0.2-1 gridExtra_2.3 mnormt_1.5-5
[43] digest_0.6.13 stringi_1.1.6 dplyr_0.7.4 RcppRoll_0.2.2 ddalpha_1.3.1 grid_3.4.3 tools_3.4.3
[50] magrittr_1.5 lazyeval_0.2.1 tibble_1.4.1 randomForest_4.6-12 tidyr_0.7.2 DRR_0.0.2 pkgconfig_2.0.1
[57] MASS_7.3-48 Matrix_1.2-12 data.table_1.10.4-3 lubridate_1.7.1 gower_0.1.2 assertthat_0.2.0 iterators_1.0.9
[64] R6_2.2.2 rpart_4.1-11 sfsmisc_1.1-1 nnet_7.3-12 nlme_3.1-131 compiler_3.4.3
zachmayer commented
Fixed in 4.0. We use the S3 methods for predict. Calling stats::predict will now dispatch the correct predict method