r - Cannot specify probability function for extraTrees model in caret package -
everyone,
recently, have been using extratrees model in caret package. however, noticed probability function extratrees model set null using following scripts:
extratrees_para <- getmodelinfo('extratrees', regex = f)[[1]] extratrees_para$prob
i noticed in original package of extratress, can used generate probability prediction classification problems. i'd specify prob function extratrees_para.
extratrees_para$prob <- function(modelfit, newdata, submodels = null){ as.data.frame(predict(modelfit, newdata, probability = true)) } extratrees_para$type <- 'classification'
then construct train function build model
extratreesgrid <- expand.grid(.mtry=1:2, .numrandomcuts=1) modelfit_extratrees <- train(outcome~., data=training_scaled_sel, method = extratrees_para, metric = "roc", trcontrol = traincontrol(method = 'repeatedcv', repeats=1, classprob = t, summaryfunction = twoclasssummary), ntree = 3000, tunegrid = extratreesgrid)
however, keep getting error message not informative
"error in train.default(x, y, weights = w, ...) : final tuning parameters not determined in addition: warning messages: 1: in nominaltrainworkflow(x = x, y = y, wts = weights, info = traininfo, : there missing values in resampled performance measures. 2: in train.default(x, y, weights = w, ...) : missing values found in aggregated results"
below session information. appreciated if can me this. thanks!
sessioninfo() r version 3.1.2 (2014-10-31) platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] lc_collate=english_united states.1252 [2] lc_ctype=english_united states.1252 [3] lc_monetary=english_united states.1252 [4] lc_numeric=c [5] lc_time=english_united states.1252 attached base packages: [1] grid stats graphics grdevices utils datasets methods [8] base other attached packages: [1] dmwr_0.4.1 biocinstaller_1.16.5 caret_6.0-41 [4] ggplot2_1.0.0 lattice_0.20-29 extratrees_1.0.5 [7] rjava_0.9-6 loaded via namespace (and not attached): [1] abind_1.4-3 bitops_1.0-6 bradleyterry2_1.0-5 [4] brglm_0.5-9 car_2.0-24 catools_1.17.1 [7] class_7.3-11 codetools_0.2-9 colorspace_1.2-4 [10] compiler_3.1.2 digest_0.6.8 e1071_1.6-4 [13] foreach_1.4.2 gdata_2.16.1 gplots_2.17.0 [16] gtable_0.1.2 gtools_3.4.1 iterators_1.0.7 [19] kernsmooth_2.23-13 lme4_1.1-7 mass_7.3-35 [22] matrix_1.1-4 mgcv_1.8-3 minqa_1.2.4 [25] munsell_0.4.2 nlme_3.1-118 nloptr_1.0.4 [28] nnet_7.3-8 parallel_3.1.2 pbkrtest_0.4-2 [31] plyr_1.8.1 proc_1.8 proto_0.3-10 [34] quantmod_0.4-4 quantreg_5.11 rcpp_0.11.4 [37] reshape2_1.4.1 rocr_1.0-7 rpart_4.1-8 [40] scales_0.2.4 sparsem_1.6 splines_3.1.2 [43] stringr_0.6.2 tools_3.1.2 ttr_0.22-0 [46] xts_0.9-7 zoo_1.7-12
i don't think generate class probabilities when first added model. i'm not sure why version didn't work here i'm adding package:
modelinfo <- list(label = "random forest randomization", library = c("extratrees"), loop = null, type = c('regression', 'classification'), parameters = data.frame(parameter = c('mtry', 'numrandomcuts'), class = c('numeric', 'numeric'), label = c('# randomly selected predictors', '# random cuts')), grid = function(x, y, len = null){ expand.grid(mtry = var_seq(p = ncol(x), classification = is.factor(y), len = len), numrandomcuts = 1:len) }, fit = function(x, y, wts, param, lev, last, classprobs, ...) extratrees(x, y, mtry = param$mtry, numrandomcuts = param$numrandomcuts, ...), predict = function(modelfit, newdata, submodels = null) predict(modelfit, newdata), prob = function(modelfit, newdata, submodels = null) predict(modelfit, newdata, probability = true), levels = function(x) x$obslevels, tags = c("random forest", "ensemble model", "bagging", "implicit feature selection"), sort = function(x) x[order(x[,1]),])
Comments
Post a Comment