如何解决Java m_classDistribution中的RandomForest Weka由于某些原因而为null
我正在尝试从weka random_forest模型中递归地收集统计信息,例如数字属性的 attribute_name,m_splitPoint 和 m_classDistribution 。 由于某些原因,在某些节点中, m_classDistribution 为空(无法提取类),在这些节点的叶子中, m_classDistribution 不为空,我可以提取所有那里的信息。 问题是为什么会这样?
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);
}
}
Weka版本3.8.0 谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。