[datatable-help] Random Forest

Michael Smith my.r.help at gmail.com
Wed Sep 24 14:34:56 CEST 2014


Since you're asking where else to post, I would suggest the R-help
mailing list for your particular case. (And be sure to read the posting
guide before sending.)

If you have a question about a specific package, you could also contact
the author/maintainer of that package (but only after you have "done
your homework" and searched around without finding a solution).

And please reply cc to the list, even if you're replying to my email,
otherwise it won't get archived and other people cannot contribute.

M

On 09/24/2014 04:42 PM, Hounkpatin Ozias wrote:
> Hi Smith,
> I looked through the replicate function. you got my question right
> actually. I have just tried it using the code:
> 
>>rep<-replicate(100, randomForest(RSG  ~  .,  data=tr,nodesize  =
> 1,ntree=1000,importance=TRUE, proximity=TRUE, mtry=2))
>>rep
> I got the result below 100 times. 
>                    
> [,1]......................................................................................... 
> [,100]
> call            Expression      
> type            "classification"
> predicted       factor,890      
> err.rate        Numeric,6000        
> confusion       Numeric,30       
> votes           Numeric,4450
> oob.times       Numeric,890        
> classes         Character,5     
> importance      Numeric,126     
> importanceSD    Numeric,108    
> localImportance NULL            
> proximity       Numeric,792100  
> ntree           1000            
> mtry            2                 
> forest          List,14                
> y               factor,890          
> test            NULL                    
> inbag           NULL                     
> terms           Expression    
> Now the question remains for me to get the OBB errors and variable
> importance, not each run, but considering the means of the 100 runs.
> When I call the following output after replicate, I got only NULL.
>> rep1$err.rate
> NULL
>> > rep1$ntree
> NULL
>> rep1$mtry
> NULL
>> rep1$y
> NULL
>  I am new in R and new also in this data list. if my post does not fit
> the purpose of the data list, I will appreciate if anyone could direct
> me to a  better platform dealing with this issue.
> Thanks.
> 
> 
> Le Mercredi 24 septembre 2014 8h53, Michael Smith <my.r.help at gmail.com>
> a écrit :
> 
> 
> Not sure whether I understand you correctly (and whether this is even a
> data.table question), but maybe you are looking for `replicate`?
> 
> M
> 
> 
> On 09/24/2014 02:55 PM, Hounkpatin Ozias wrote:
>> Hello to everyone,
>>
>> I am interested in doing some iteration in using Random Forest
>> (classification purpose) with different value of mtry= 2, 4, 6, 9, 12. I
>> want to repeat each run 100 times. that is with mtry=2 for example, run
>> it 100 times. As output, I would like to have the aggregate out of bag
>> errors (total means over the 100 runs) as well as well as the variable
>> importance based on this 100 runs aggregated over their OBB errors. One
>> could try it one by one, report each value but it is very laborious. Is
>> there anyway to have R run the Random Forest 100 times, and give me as
>> output the resulting (aggregated means) OOB errors and variable
>> importance. here was my code.
>>
>> r2  <-  randomForest(Factor  ~  .,  data=tr, nodesize  = 1,ntree=1000,
>> importance=TRUE, proximity=TRUE, mtry=2)
>> #I want a 100 run of this
>> #get average OOB errors
>> #get variable importance based on these aggregated OBB errors.
>>
>> Thank you very much.
>>
>>
>>
>> _______________________________________________
>> datatable-help mailing list
>> datatable-help at lists.r-forge.r-project.org
> <mailto:datatable-help at lists.r-forge.r-project.org>
>>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>>
> 
> 


More information about the datatable-help mailing list