Thread Subject: Random Forest Classifier Output

Subject: Random Forest Classifier Output

From: Mr. Sumon

Date: 1 Feb, 2011 09:49:04

Message: 1 of 6

Dear All,
            I am very new to use random forest. I have random forest code with example. If I run the program it gives the following output. I need to know the meaning of those outputs

nrnodes: 317
           ntree: 100
      xbestsplit: [317x100 double]
         classwt: [2x1 double]
          cutoff: [2x1 double]
         treemap: [317x200 int32]
      nodestatus: [317x100 int32]
       nodeclass: [317x100 int32]
         bestvar: [317x100 int32]
       ndbigtree: [317x100 int32]
            mtry: 4
     orig_labels: [2x1 double]
      new_labels: [1 2]
          nclass: 2
           outcl: [250x1 int32]
         counttr: [2x250 int32]
       proximity: []
        localImp: 1
      importance: [20x1 double]
    importanceSD: 0
           errtr: [100x3 double]
           inbag: [250x100 int32]
           votes: [250x2 int32]
       oob_times: [250x1 double]


I also want to get the confusion matrix as output. How can I get that.


Sumon

Subject: Random Forest Classifier Output

From: Steven_Lord

Date: 1 Feb, 2011 14:38:22

Message: 2 of 6



"Mr. Sumon" <sumon_ruape@yahoo.com> wrote in message
news:ii8kug$hre$1@fred.mathworks.com...
> Dear All,
> I am very new to use random forest. I have random forest code
> with example. If I run the program it gives the following output. I need
> to know the meaning of those outputs

*snip*

I don't recognize this output as being from a function in MATLAB or any of
the toolboxes with which I'm familiar.

I suggest you read the help text and/or the documentation for the function
you're using. If that still doesn't provide you enough information, reply
in the newsgroup with the name of the function and the location from which
you obtained it and someone may be able to offer some suggestions.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Random Forest Classifier Output

From: Tom Lane

Date: 1 Feb, 2011 15:31:03

Message: 3 of 6

> I am very new to use random forest. I have random forest code
> with example. If I run the program it gives the following output. I need
> to know the meaning of those outputs

I agree with Steve's answer.

> I also want to get the confusion matrix as output. How can I get that.

If the random forest function you're using can predict class values, and if
you have the Statistics Toolbox, then you can use the confusionmat function
to compute the confusion matrix.

-- Tom

Subject: Random Forest Classifier Output

From: Ilya_Narsky

Date: 1 Feb, 2011 17:16:59

Message: 4 of 6



"Mr. Sumon" <sumon_ruape@yahoo.com> wrote in message
news:ii8kug$hre$1@fred.mathworks.com...
> Dear All,
> I am very new to use random forest. I have random forest code
> with example. If I run the program it gives the following output. I need
> to know the meaning of those outputs
>
> nrnodes: 317
> ntree: 100
> xbestsplit: [317x100 double]
> classwt: [2x1 double]
> cutoff: [2x1 double]
> treemap: [317x200 int32]
> nodestatus: [317x100 int32]
> nodeclass: [317x100 int32]
> bestvar: [317x100 int32]
> ndbigtree: [317x100 int32]
> mtry: 4
> orig_labels: [2x1 double]
> new_labels: [1 2]
> nclass: 2
> outcl: [250x1 int32]
> counttr: [2x250 int32]
> proximity: []
> localImp: 1
> importance: [20x1 double]
> importanceSD: 0
> errtr: [100x3 double]
> inbag: [250x100 int32]
> votes: [250x2 int32]
> oob_times: [250x1 double]
>
>
> I also want to get the confusion matrix as output. How can I get that.
>
>
> Sumon

If you have Statistics Toolbox, you can use TreeBagger instead of whatever
you are using now. In that case, you can do 'doc TreeBagger' and 'help
TreeBagger'.

Subject: Random Forest Classifier Output

From: Dave

Date: 1 Feb, 2011 17:47:04

Message: 5 of 6

Looks like you're using the Random Forest code ported to Matlab by Abhishek Jaiantilal. Since this is based on the same C-code as the randomForest package for R by Liaw & Wiener, you should read the R documentation to understand the Matlab output.

http://cran.r-project.org/web/packages/randomForest/



You can use this for generating a confusion matrix:


function err = f_errRate(grp,cls)
% - error rate for a classifier
%
% USAGE: err = f_errRate(grp,cls)
%
% grp = input vector of integers specifying group membership
% cls = group membership predicted by the classifier
%
% err = structure of results having the following fields:
% err.tot = total error
% err.grp = total error for each group
% err.conf = confusion matrix (proportion of CLS classified as GRP)
%
% SEE ALSO: f_cdaCV, f_boot632

% -----Notes:-----
% This function is used to determine error rates for classifiers; in
% particular, it is called by f_cdaCV. More robust measures of
% generalization error may be achieved using f_boot632, etc.

% -----Author:-----
% by David L. Jones,<djones@rsmas.miami.edu> Feb-2004
% This file is part of the FATHOM Toolbox:
% http://www.rsmas.miami.edu/personal/djones/
%
% This code is provided as is, with no guarantees.

% -----Check input:-----
grp = grp(:);
cls = cls(:);

if size(grp,1) ~= size(cls,1)
   error('GRP and CLS must be same size!')
end
% -----------------------

n = size(grp,1); % # obs
uGrp = unique(grp); % unique groups
noGrp = size(uGrp,1); % # of groups

% Preallocate:
err.tot = NaN;
err.grp = zeros(noGrp,1);
err.conf = zeros(noGrp,noGrp);

for i=1:noGrp
   idx = find(grp==uGrp(i));
   grpSize = size(idx,1);
   
   % Confusion matrix:
   for j=1:noGrp
      err.conf(i,j) = [sum(logical(cls(idx) == uGrp(j)))]/grpSize;
   end
end

% Total error rate:
err.tot = [sum(logical([grp - cls] ~= 0))]/n; % 1=pass, 0=fail

% Error rate by group:
err.grp = diag([1 - err.conf]);

Subject: Random Forest Classifier Output

From: Mr. Sumon

Date: 2 Feb, 2011 00:28:04

Message: 6 of 6

Thank you for your suggestion.
Actually I got those code from here
http://code.google.com/p/randomforest-matlab/downloads/detail?name=Windows-Precompiled-RF_MexStandalone-v0.02-.zip&can=2&q=

And I am using their tutorial_ClassRF.m file. After running the classRF_train() function I get those output.

There are another nice source of RF here

http://lib.stat.cmu.edu/matlab/

but these code only for Matlab R13 or R12. but I am using matlab 7.10.0.
This package has fortran source code, but I am not sure whether it is possible to generate mex file from that code or not.

"Steven_Lord" <slord@mathworks.com> wrote in message <ii95su$pqh$1@fred.mathworks.com>...
>
>
> "Mr. Sumon" <sumon_ruape@yahoo.com> wrote in message
> news:ii8kug$hre$1@fred.mathworks.com...
> > Dear All,
> > I am very new to use random forest. I have random forest code
> > with example. If I run the program it gives the following output. I need
> > to know the meaning of those outputs
>
> *snip*
>
> I don't recognize this output as being from a function in MATLAB or any of
> the toolboxes with which I'm familiar.
>
> I suggest you read the help text and/or the documentation for the function
> you're using. If that still doesn't provide you enough information, reply
> in the newsgroup with the name of the function and the location from which
> you obtained it and someone may be able to offer some suggestions.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
random forest Mr. Sumon 1 Feb, 2011 04:54:05
rssFeed for this Thread

Contact us at files@mathworks.com