src/main/java/weka/classifiers/trees/RandomForestPMMLConsumer.java
private static RandomTree.Tree buildRandomTreeNode(RandomTree tree, Node pmmlNode) {
        RandomTree.Tree treeNode = tree.new Tree();
        //Set the class distribution.
        treeNode.m_ClassDistribution = getClassDistribution(pmmlNode);

        Instances instances = tree.m_Info;

        boolean isLeaf = pmmlNode.getNodes().size() == 0;

        if (!isLeaf) {
            List<Node> children = pmmlNode.getNodes();

            String attributeName = ((SimplePredicate) children.get(0).getPredicate()).getField().getValue();
            Attribute attribute = instances.attribute(attributeName);

            treeNode.m_Attribute = attribute.index();

            if (attribute.isNumeric()) {
                /*
                  If the node is numeric, get its two child nodes and covert them into a new RandomTree.Tree node.
                  For example, consider the following PPML Node:

                     <Node id="2">
                       <SimplePredicate field="petal_length" operator="lessThan" value="5.05"/>
                       <Node id="3" score="Iris-setosa">
                         <SimplePredicate field="petal_length" operator="lessThan" value="2.95"/>
                       </Node>
                       <Node id="4" score="Iris-versicolor">
                         <SimplePredicate field="petal_length" operator="greaterOrEqual" value="2.95"/>
                       </Node>
                     </Node>

                  We'll grab the two child nodes and their value will be the split point of the current RandomTree.Tree node.
                */
                assert children.size() == 2 : "Numeric attributes must have exactly 2 children";

                Node left = children.get(0);
                Node right = children.get(1);

                Predicate leftPredicate = left.getPredicate();
                Predicate rightPredicate = right.getPredicate();

                assert leftPredicate instanceof SimplePredicate && leftPredicate.getClass().equals(rightPredicate.getClass()) : "Numeric attribute's nodes must have the same simple predicate.";

                double splitPoint = Double.valueOf(((SimplePredicate) leftPredicate).getValue());

                treeNode.m_SplitPoint = splitPoint;
                treeNode.m_Successors = new RandomTree.Tree[]{buildRandomTreeNode(tree, left), buildRandomTreeNode(tree, right)};
                treeNode.m_Prop = new double[]{getNodeTrainingProportion(left), getNodeTrainingProportion(right)};
            } else if (attribute.isNominal()) {

                treeNode.m_Successors = new RandomTree.Tree[children.size()];
                treeNode.m_Prop = new double[treeNode.m_Successors.length];

                for (int i = 0; i < children.size(); i++) {
                    Node child = children.get(i);

                    SimplePredicate predicate = (SimplePredicate) child.getPredicate();
                    int valueIndex = attribute.indexOfValue(predicate.getValue());

                    treeNode.m_Successors[valueIndex] = buildRandomTreeNode(tree, child);
                    treeNode.m_Prop[valueIndex] = getNodeTrainingProportion(child);
                }
            } else {
                throw new RuntimeException("Attribute type not supported: " + attribute);
            }
        }

        return treeNode;
    }
private static RandomTree.Tree buildRandomTreeNode(RandomTree tree, Node pmmlNode) {
        RandomTree.Tree treeNode = tree.new Tree();
        //Set the class distribution.
        treeNode.m_ClassDistribution = getClassDistribution(pmmlNode);

        Instances instances = tree.m_Info;

        boolean isLeaf = pmmlNode.getNodes().size() == 0;

        if (!isLeaf) {
            List<Node> children = pmmlNode.getNodes();

            String attributeName = ((SimplePredicate) children.get(0).getPredicate()).getField().getValue();
            Attribute attribute = instances.attribute(attributeName);

            treeNode.m_Attribute = attribute.index();

            if (attribute.isNumeric()) {
                /*
                  If the node is numeric, get its two child nodes and covert them into a new RandomTree.Tree node.
                  For example, consider the following PPML Node:

                     <Node id="2">
                       <SimplePredicate field="petal_length" operator="lessThan" value="5.05"/>
                       <Node id="3" score="Iris-setosa">
                         <SimplePredicate field="petal_length" operator="lessThan" value="2.95"/>
                       </Node>
                       <Node id="4" score="Iris-versicolor">
                         <SimplePredicate field="petal_length" operator="greaterOrEqual" value="2.95"/>
                       </Node>
                     </Node>

                  We'll grab the two child nodes and their value will be the split point of the current RandomTree.Tree node.
                */
                assert children.size() == 2 : "Numeric attributes must have exactly 2 children";

                Node left = children.get(0);
                Node right = children.get(1);

                Predicate leftPredicate = left.getPredicate();
                Predicate rightPredicate = right.getPredicate();

                assert leftPredicate instanceof SimplePredicate && leftPredicate.getClass().equals(rightPredicate.getClass()) : "Numeric attribute's nodes must have the same simple predicate.";

                double splitPoint = Double.valueOf(((SimplePredicate) leftPredicate).getValue());

                treeNode.m_SplitPoint = splitPoint;
                treeNode.m_Successors = new RandomTree.Tree[]{buildRandomTreeNode(tree, left), buildRandomTreeNode(tree, right)};
                treeNode.m_Prop = new double[]{getNodeTrainingProportion(left), getNodeTrainingProportion(right)};
            } else if (attribute.isNominal()) {

                treeNode.m_Successors = new RandomTree.Tree[children.size()];
                treeNode.m_Prop = new double[treeNode.m_Successors.length];

                for (int i = 0; i < children.size(); i++) {
                    Node child = children.get(i);

                    SimplePredicate predicate = (SimplePredicate) child.getPredicate();
                    int valueIndex = attribute.indexOfValue(predicate.getValue());

                    treeNode.m_Successors[valueIndex] = buildRandomTreeNode(tree, child);
                    treeNode.m_Prop[valueIndex] = getNodeTrainingProportion(child);
                }
            } else {
                throw new RuntimeException("Attribute type not supported: " + attribute);
            }
        }

        return treeNode;
    }
Builds a {@link weka.classifiers.trees.RandomTree.Tree Weka RandomTree} node
represented by the given {@link org.dmg.pmml.Node PMML node}.

@param tree     The {@link weka.classifiers.trees.RandomTree Weka RandomTree} which the returned tree node is part of.
@param pmmlNode The {@link org.dmg.pmml.PMML PMML node} to be converted to a {@link weka.classifiers.trees.RandomTree.Tree Weka RandomTree} node.
@return A new {@link weka.classifiers.trees.RandomTree.Tree Weka RandomTree} node.