access to path produced by train mehtod
Hello,
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
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.
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...
<nodes><_><depth>0</depth><sample_count>314</sample_count><value>-1.</value><norm_class_idx>0</norm_class_idx><Tn>0</Tn><complexity>0</complexity><alpha>0.</alpha><node_risk>24.</node_risk><tree_risk>0.</tree_risk><tree_error>0.</tree_error><splits><_><var>0</var><quality>2.7262069702148438e+02</quality><le>0.</le></_></splits></_><_>
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.
ok , thanks for your helps..