Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Random Forest confidency.

Hi, i'm using RTrees in opencv 3.0. Although i'm able to obtain the class label for each sample i can't obtain the number of votes for the sample. Looking at the source code: if( predictType == PREDICT_MAX_VOTE ) { int best_idx = lastClassIdx; if( range.end - range.start > 1 ) { best_idx = 0; for( i = 1; i < nclasses; i++ ) if( votes[best_idx] < votes[i] ) best_idx = i; } sum = (flags & RAW_OUTPUT) ? (float)best_idx : classLabels[best_idx]; }

what i need is votes array. Anyone knows how to get it? Thanks

click to hide/show revision 2
No.2 Revision

updated 2016-01-19 08:57:35 -0600

berak gravatar image

Random Forest confidency.

Hi, i'm using RTrees in opencv 3.0. Although i'm able to obtain the class label for each sample i can't obtain the number of votes for the sample. Looking at the source code:

 if( predictType == PREDICT_MAX_VOTE )
    {
        int best_idx = lastClassIdx;
        if( range.end - range.start > 1 )
        {
            best_idx = 0;
            for( i = 1; i < nclasses; i++ )
                if( votes[best_idx] < votes[i] )
                    best_idx = i;
        }
        sum = (flags & RAW_OUTPUT) ? (float)best_idx : classLabels[best_idx];
    }

}

what i need is votes array. Anyone knows how to get it? Thanks