Max Categories, MaxDepth in Random Forest

asked 2019-12-10 10:26:09 -0500

Masroor gravatar image

updated 2019-12-10 12:12:04 -0500

LBerger gravatar image

Hi,

I was looking the Random Forest Classifier in Open CV. There are number of variables to set as per the examples I found. I was investigating Two Variables setMaxCategories(), and setMaxDepth(). In the class precomp.hpp, it seems there is an upper limitation i.e.:

inline void setMaxCategories(int val)
        {
            if( val < 2 )
                CV_Error( CV_StsOutOfRange, "max_categories should be >= 2" );
            maxCategories = std::min(val, 15 );
        }

inline void setMaxDepth(int val)
        {
            if( val < 0 )
                CV_Error( CV_StsOutOfRange, "max_depth should be >= 0" );
            maxDepth = std::min( val, 25 );
        }

In both cases std::min will return 15 and 25 regardless of the Max Categories and Max Depth is defined by a user. Documentation related to both does not indicate the logic or reason for the upper value.

Please guide me on this issue as in my case I want to use higher values for both but code always set it to the upper limit defined in the code.

Many thanks.

Maz

edit retag flag offensive close merge delete

Comments

1

so, we should find out, why there are hardcoded caps for this ?

berak gravatar imageberak ( 2019-12-10 12:35:42 -0500 )edit

Yes. As in many cases one would like to use higher values.

Masroor gravatar imageMasroor ( 2019-12-10 13:01:29 -0500 )edit

Is there any luck?

Masroor gravatar imageMasroor ( 2019-12-16 11:09:14 -0500 )edit

I was wondering if there is any explanation to this setting. Still waiting for the answer.

Masroor gravatar imageMasroor ( 2020-01-03 08:59:07 -0500 )edit