[R] Final models from caret's train function

Patrick Connolly p_connolly at slingshot.co.nz
Tue Oct 31 09:10:07 CET 2017


Using caret on the Titanic data from Kaggle, I tried various models,
including rfRules which produces a model, partly described as such:

          
> caret.rfRules.cv$finalModel
$model
      len freq     err                 
 [1,] "2" "0.0368" "0"                 
 [2,] "2" "0.032"  "0.05"              
 [3,] "2" "0.1824" "0.0526315789473685"
 [4,] "4" "0.0656" "0.0975609756097561"
 [5,] "4" "0.0304" "0.105263157894737" 
 [6,] "3" "0.4384" "0.105839416058394" 
 [7,] "3" "0.0112" "0.142857142857143" 
 [8,] "4" "0.0256" "0.1875"            
 [9,] "3" "0.1088" "0.279411764705882" 
[10,] "3" "0.056"  "0.342857142857143" 
[11,] "1" "0.0128" "0.25"              
      condition                                                           pred
 [1,] "X[,4]<=7 & X[,11]<=4.5"                                            "1" 
 [2,] "X[,7]<=31.33125 & X[,11]>4.5"                                      "0" 
 [3,] "X[,2]<=0.5 & X[,3]<=0.5"                                           "1" 
 [4,] "X[,2]>0.5 & X[,4]<=30.5 & X[,5]>0.5 & X[,9]>0.5"                   "0" 
 [5,] "X[,3]<=0.5 & X[,4]<=30.2031919426199 & X[,4]>21.5 & X[,9]<=0.5"    "1" 
 [6,] "X[,3]>0.5 & X[,4]>9.5 & X[,7]<=26.26875"                           "0" 
 [7,] "X[,2]>0.5 & X[,7]>13.90835 & X[,7]<=15.3729"                       "0" 
 [8,] "X[,4]<=40.8653667208804 & X[,4]>25 & X[,7]>26.14375 & X[,11]<=1.5" "1" 
 [9,] "X[,3]>0.5 & X[,4]>8.16718191075288 & X[,4]<=77"                    "0" 
[10,] "X[,3]<=0.5 & X[,4]<=38.5 & X[,4]>12.5"                             "1" 
[11,] "X[,1]==X[,1]"                                                      "0" 

[...]

Does that 11th row make sense?  X[,1]==X[,1] will always be true, so
is that saying anything?  Or is it a case of a model for prediction
being useless for inference?


> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          4.1                         
year           2017                        
month          06                          
day            30                          
svn rev        72865                       
language       R                           
version.string R version 3.4.1 (2017-06-30)
nickname       Single Candle     

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list