src/main/java/weka/classifiers/trees/RandomForestPMMLProducer.java
private static int buildNominalNode(RandomTree tree, Attribute attribute, RandomTree.Tree node, int nodeId, Node parentPMMLNode) {
        List<Object> values = new ArrayList<>();
        Enumeration enumeration = attribute.enumerateValues();
        while (enumeration.hasMoreElements()) {
            values.add(enumeration.nextElement());
        }

        assert values.size() == node.m_Successors.length : "Number of successors expected to be the same as the number of attribute values";

        List<Node> children = new ArrayList<>();

        for (int i = 0; i < values.size(); i++) {
            Object value = values.get(i);

            SimplePredicate predicate = new SimplePredicate(new FieldName(attribute.name()), SimplePredicate.Operator.EQUAL).withValue(String.valueOf(value));
            Node child = new Node().withId(String.valueOf(++nodeId)).withPredicate(predicate);

            nodeId = buildTreeNode(tree, node.m_Successors[i], nodeId, child);

            // Training proportion extension.
            child.withExtensions(new Extension().withName(TRAINING_PROPORTION_ELEMENT).withValue(String.valueOf(node.m_Prop[i])));

            children.add(child);
        }

        parentPMMLNode.withNodes(children);

        return nodeId;
    }
private static int buildNominalNode(RandomTree tree, Attribute attribute, RandomTree.Tree node, int nodeId, Node parentPMMLNode) {
        List<Object> values = new ArrayList<>();
        Enumeration enumeration = attribute.enumerateValues();
        while (enumeration.hasMoreElements()) {
            values.add(enumeration.nextElement());
        }

        assert values.size() == node.m_Successors.length : "Number of successors expected to be the same as the number of attribute values";

        List<Node> children = new ArrayList<>();

        for (int i = 0; i < values.size(); i++) {
            Object value = values.get(i);

            SimplePredicate predicate = new SimplePredicate(new FieldName(attribute.name()), SimplePredicate.Operator.EQUAL).withValue(String.valueOf(value));
            Node child = new Node().withId(String.valueOf(++nodeId)).withPredicate(predicate);

            nodeId = buildTreeNode(tree, node.m_Successors[i], nodeId, child);

            // Training proportion extension.
            child.withExtensions(new Extension().withName(TRAINING_PROPORTION_ELEMENT).withValue(String.valueOf(node.m_Prop[i])));

            children.add(child);
        }

        parentPMMLNode.withNodes(children);

        return nodeId;
    }
Builds the {@link org.dmg.pmml.Node PMML Node} for a nominal attribute.
<p/>
In PMML these nodes are represented with multiple children, one for each of the attribute's values.
<p/>
For example, consider a nominal attribute, named "nominalAttribute", with values "cold", "hot" and "warm". In PMML this translates to:
<pre>
{@code
<Node id="2" score="1">
<SimplePredicate field="nominalAttribute" operator="equal" value="cold"/>
</Node>
<Node id="3" score="0">
<SimplePredicate field="nominalAttribute" operator="equal" value="hot"/>
</Node>
<Node id="4" score="1.5">
<SimplePredicate field="nominalAttribute" operator="equal" value="warm"/>
</Node>
}
</pre>

@param tree           The {@link weka.classifiers.trees.RandomTree Weka RandomTree} being converted to a {@link org.dmg.pmml.PMML TreeModel}.
@param attribute      The {@link weka.core.Attribute} to which the node to build refers to.
@param node           The {@link weka.classifiers.trees.RandomTree.Tree Weka RandomTree node} we are converting to PMML.
@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}.