src/main/java/weka/classifiers/trees/RandomForestPMMLProducer.java
private static int buildTreeNode(RandomTree tree, RandomTree.Tree node, int nodeId, Node parentPMMLNode) {
        addScoreDistribution(parentPMMLNode, node.m_ClassDistribution, tree.m_Info);

        if (node.m_Attribute == -1) {
            // Leaf: Add the node's score.
            parentPMMLNode.withScore(leafScoreFromDistribution(node.m_ClassDistribution, tree.m_Info));
            return nodeId;
        }

        Attribute attribute = tree.m_Info.attribute(node.m_Attribute);

        if (attribute.isNominal()) {
            return buildNominalNode(tree, attribute, node, nodeId, parentPMMLNode);
        } else if (attribute.isNumeric()) {
            return buildNumericNode(tree, attribute, node, nodeId, parentPMMLNode);
        } else {
            throw new RuntimeException("Unsupported attribute type for: " + attribute);
        }
    }
private static int buildTreeNode(RandomTree tree, RandomTree.Tree node, int nodeId, Node parentPMMLNode) {
        addScoreDistribution(parentPMMLNode, node.m_ClassDistribution, tree.m_Info);

        if (node.m_Attribute == -1) {
            // Leaf: Add the node's score.
            parentPMMLNode.withScore(leafScoreFromDistribution(node.m_ClassDistribution, tree.m_Info));
            return nodeId;
        }

        Attribute attribute = tree.m_Info.attribute(node.m_Attribute);

        if (attribute.isNominal()) {
            return buildNominalNode(tree, attribute, node, nodeId, parentPMMLNode);
        } else if (attribute.isNumeric()) {
            return buildNumericNode(tree, attribute, node, nodeId, parentPMMLNode);
        } else {
            throw new RuntimeException("Unsupported attribute type for: " + attribute);
        }
    }
Builds a new {@link org.dmg.pmml.Node PMML Node} from the given {@link RandomTree.Tree Weka Tree Node}.

@param tree           The {@link weka.classifiers.trees.RandomTree Weka RandomTree} being converted to a {@link org.dmg.pmml.PMML TreeModel}.
@param node           The Id to give to the generted {@link org.dmg.pmml.Node PMML Node}.
@param nodeId         The Id to give to the generted {@link org.dmg.pmml.Node PMML Node}.
@param parentPMMLNode The parent {@link org.dmg.pmml.Node PMML Node}.
@return The incremented Id given to recursively created {@link org.dmg.pmml.Node PMML Nodes}.