Cannot specify probability function for extraTrees model in caret package
1
0
Entering edit mode
liuy12 • 0
@liuy12-8009
Last seen 9.4 years ago
United States

Hello ,everyone, 

Recently, I have been using extraTrees model in caret package. However, I noticed that the probability function for extraTrees model is set to NULL by using the following scripts:

    extratrees_para <- getModelInfo('extraTrees', regex = F)[[1]]

    extratrees_para$prob

I noticed that in the original package of extraTress, it can be used to generate probability prediction for classification problems. So I'd like to specify the prob function for extratrees_para. 

    extratrees_para$prob <- function(modelFit, newdata, submodels = NULL){
    as.data.frame(predict(modelFit, newdata, probability = TRUE))
    }
    extratrees_para$type <- 'Classification'

Then I construct train function to build the 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, I keep getting this error message which is not very informative 

"Error in train.default(x, y, weights = w, ...) : 
  final tuning parameters could not be determined
In addition: Warning messages:
1: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo,  :
  There were missing values in resampled performance measures.
2: In train.default(x, y, weights = w, ...) :
  missing values found in aggregated results"

Below is my session information. I would be really appreciated if anyone can help me with 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 a 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      

 

 

 

 

caret extraTrees machinelearning • 1.9k views
ADD COMMENT
1
Entering edit mode
liuy12 • 0
@liuy12-8009
Last seen 9.4 years ago
United States

Turns out that I have a older version of caret and extraTrees. I updated the packages and everything works fine now! 

ADD COMMENT

Login before adding your answer.

Traffic: 954 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6