weka RandomForest in JAVA: classes distribution (m_classDistribution)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

weka RandomForest in JAVA: classes distribution (m_classDistribution)

Yuri
I am trying to collect recursively the statistics from the weka random_forest model, like attribute_name, m_splitPoint and m_classDistribution for numeric attributes. For some reason, in some nodes, m_classDistribution is null (can't extract classes) and in the leaves of these nodes m_classDistribution is not null, and I can extract all the info from there.
The question is why classes are not presented in all nodes?

Java code:
```
StatisticTrees.java contains the list of NodeStatistics

protected void generateStatisticTree(StatisticTrees tree, int level) {
            if (m_Attribute == -1) {
                // leaf info
                m_classDistribution is not null here
            } else {
                String name = m_Info.attribute(m_Attribute).name(),
                double splitPoint = m_SplitPoint;
                NodeStatistics nodeStatistics = new NodeStatistics(name, splitPoint);
         
                //For some nodes this is null
                if (m_ClassDistribution != null) {
                    nodeStatistics.setClassesDistribution(m_ClassDistribution);
                }
                tree.add(nodeStatistics)

                 //left
                m_Successors[0].generateStatisticTree(tree, level + 1);
                 //right
                m_Successors[1].generateStatisticTree(tree, level + 1);
            }
        }
```
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html