access to path produced by train mehtod

asked 2014-01-23 07:07:58 -0500

jossyy gravatar image


I am using random trees. Sometimes I encounter that I dont expect the result of predict function.

So I want to see content of trees. I know CvRTrees::get_tree_count() and CvForestTree* CvRTrees::get_tree(int i). I dont know how can I see the classcifiar path

edit retag flag offensive close merge delete


Try saving the random forest out to an xml/yaml file. It won't be pretty to process manually by hand but it's do-able, at least for a single tree.

Nghia gravatar imageNghia ( 2014-01-24 03:34:41 -0500 )edit

How can I understand this xml file ? My output is below , which attribute says it's right and left node , or it's response value...


jossyy gravatar imagejossyy ( 2014-01-24 06:24:55 -0500 )edit

I'm a bit more familiar with the YAML format, but the important info to look for are: depth (tree depth), var (feature used to split on, index to your array), le (less than or equal), value (the value it is comparing to). If the current value is "less than or equal" to "value" the it branches left, else right. Helps to sketch it on paper.

Nghia gravatar imageNghia ( 2014-01-24 07:04:17 -0500 )edit

ok , thanks for your helps..

jossyy gravatar imagejossyy ( 2014-01-25 11:16:10 -0500 )edit