zachmayer / caretEnsemble

caret models all the way down :turtle:
Other
226 stars 75 forks source link

methodCheck mxnet #208

Closed sparcycram closed 7 years ago

sparcycram commented 8 years ago

I am receiving this error in caretEnsemble

Error in methodCheck(methods) : The following models are not valid caret models: mxnet

This is strange as mxnet is a valid caret model?

Any ideas

zachmayer commented 8 years ago

Please post a reproducible example

Sent from my iPhone

On Jul 2, 2016, at 6:10 AM, sparcycram notifications@github.com wrote:

I am receiving this error in caretEnsemble

Error in methodCheck(methods) : The following models are not valid caret models: mxnet

This is strange as mxnet is a valid caret model?

Any ideas

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

sparcycram commented 7 years ago

This should run and produce the error

library(MASS) data("Aids2") TRAIN <- as.data.frame(Aids2) training_x <- subset(TRAIN, select = -c(status))

library("caret") library("caretEnsemble") library("glmnet") library("mxnet") library("drat") library("arm")

my_control <- trainControl( method='cv', number=2, repeats =3, classProbs=TRUE, summaryFunction= twoClassSummary )

set.seed(1234) model_list_big <- caretList( training_x, TRAIN$status, trControl=my_control, metric= "ROC", tuneList=list( avMxnet0 = caretModelSpec(method ="avMxnet"), glm0 = caretModelSpec(method="glm")

) )

model_list_big

sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server >= 2012 x64 (build 9200)

locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] arm_1.8-6 lme4_1.1-12 drat_0.1.0 mxnet_0.7 glmnet_2.0-5 foreach_1.4.3
[7] Matrix_1.2-6 caretEnsemble_2.0.0 caret_6.0-70 ggplot2_2.1.0 lattice_0.20-33 MASS_7.3-45

loaded via a namespace (and not attached): [1] Rcpp_0.12.5 nloptr_1.0.4 plyr_1.8.4 iterators_1.0.8 tools_3.3.1 digest_0.6.9
[7] jsonlite_1.0 nlme_3.1-128 gtable_0.2.0 mgcv_1.8-12 rstudioapi_0.6 parallel_3.3.1
[13] SparseM_1.7 coda_0.18-1 gridExtra_2.2.1 DiagrammeR_0.8.2 stringr_1.0.0 htmlwidgets_0.6
[19] MatrixModels_0.4-1 stats4_3.3.1 grid_3.3.1 nnet_7.3-12 data.table_1.9.6 pbapply_1.2-1
[25] minqa_1.2.4 reshape2_1.4.1 car_2.1-2 magrittr_1.5 scales_0.4.0 codetools_0.2-14
[31] htmltools_0.3.5 splines_3.3.1 abind_1.4-3 pbkrtest_0.4-6 colorspace_1.2-6 quantreg_5.26
[37] stringi_1.1.1 visNetwork_1.0.1 munsell_0.4.3 chron_2.3-47

Thanks

zachmayer commented 7 years ago

I don't have mxnet installed (and it doesn't seem to be on CRAN anymore). Can you run a simple caret model with method = 'avMxnet'?

zachmayer commented 7 years ago

I got it installed from the drat repo. If I change the mxnet model to an 'rpart' model, the code runs fine, so it's probably a problem with caret or mxnet.

zachmayer commented 7 years ago

The problem is that avMxnet isn't a valid caret model. You can only run valid caret models with caretList (and you can't run custom models).

caret::modelLookup('avMxnet')
zachmayer commented 7 years ago
model_list_big <- train(
  training_x, TRAIN$status,
  trControl=my_control,
  metric= "ROC", 
  method='avMxnet'
)

yields:

 Error in train.default(training_x, TRAIN$status, trControl = my_control,  : 
  Model avMxnet is not in caret's built-in library

If you get a model error in caretEnsemble always try to run the model in question as a simple caret model.

sparcycram commented 7 years ago

Thanks ill take it up with caret. On the caret website

Model Averaged Neural Network avMxnet Classification mxnet layer1, layer2, layer3, learning.rate, momentum, dropout, repeats

Sent from my iPad

On 12 Jul 2016, at 22:08, Zach Mayer notifications@github.com wrote:

model_list_big <- train( training_x, TRAIN$status, trControl=my_control, metric= "ROC", method='avMxnet' ) yields:

Error in train.default(training_x, TRAIN$status, trControl = my_control, : Model avMxnet is not in caret's built-in library If you get a model error in caretEnsemble always try to run the model in question as a simple caret model.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

zachmayer commented 7 years ago

You probably need to install carry from GitHub rather than cran

Sent from my iPhone

On Jul 12, 2016, at 7:19 PM, sparcycram notifications@github.com wrote:

Thanks ill take it up with caret. On the caret website

Model Averaged Neural Network avMxnet Classification mxnet layer1, layer2, layer3, learning.rate, momentum, dropout, repeats

Sent from my iPad

On 12 Jul 2016, at 22:08, Zach Mayer notifications@github.com wrote:

model_list_big <- train( training_x, TRAIN$status, trControl=my_control, metric= "ROC", method='avMxnet' ) yields:

Error in train.default(training_x, TRAIN$status, trControl = my_control, : Model avMxnet is not in caret's built-in library If you get a model error in caretEnsemble always try to run the model in question as a simple caret model.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.