Search in sources :

Example 11 with SimplePredicate

use of org.dmg.pmml.SimplePredicateDocument.SimplePredicate in project knime-core by knime.

the class PMMLRuleTranslator method setPredicate.

/**
 * For an xml {@link CompoundPredicate} ({@code cp}) sets the parameters based on {@code pred}'s properties.
 *
 * @param cp An xml {@link CompoundPredicate}.
 * @param pred The {@link PMMLPredicate} with the rule version subclasses.
 */
private void setPredicate(final CompoundPredicate cp, final PMMLPredicate pred) {
    if (pred instanceof PMMLFalsePredicate) {
        cp.addNewFalse();
    } else if (pred instanceof PMMLTruePredicate) {
        cp.addNewTrue();
    } else if (pred instanceof PMMLSimplePredicate) {
        PMMLSimplePredicate simple = (PMMLSimplePredicate) pred;
        SimplePredicate s = cp.addNewSimplePredicate();
        s.setField(simple.getSplitAttribute());
        setOperator(s, simple);
        s.setValue(simple.getThreshold());
    } else if (pred instanceof PMMLCompoundPredicate) {
        PMMLCompoundPredicate compound = (PMMLCompoundPredicate) pred;
        CompoundPredicate c = cp.addNewCompoundPredicate();
        setCompound(c, compound);
    } else if (pred instanceof PMMLSimpleSetPredicate) {
        PMMLSimpleSetPredicate set = (PMMLSimpleSetPredicate) pred;
        SimpleSetPredicate ss = cp.addNewSimpleSetPredicate();
        setSetPredicate(ss, set);
    }
}
Also used : PMMLTruePredicate(org.knime.base.node.mine.decisiontree2.PMMLTruePredicate) PMMLSimpleSetPredicate(org.knime.base.node.mine.decisiontree2.PMMLSimpleSetPredicate) PMMLSimplePredicate(org.knime.base.node.mine.decisiontree2.PMMLSimplePredicate) PMMLCompoundPredicate(org.knime.base.node.mine.decisiontree2.PMMLCompoundPredicate) CompoundPredicate(org.dmg.pmml.CompoundPredicateDocument.CompoundPredicate) PMMLFalsePredicate(org.knime.base.node.mine.decisiontree2.PMMLFalsePredicate) PMMLSimplePredicate(org.knime.base.node.mine.decisiontree2.PMMLSimplePredicate) SimplePredicate(org.dmg.pmml.SimplePredicateDocument.SimplePredicate) PMMLCompoundPredicate(org.knime.base.node.mine.decisiontree2.PMMLCompoundPredicate) PMMLSimpleSetPredicate(org.knime.base.node.mine.decisiontree2.PMMLSimpleSetPredicate) SimpleSetPredicate(org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate)

Aggregations

SimplePredicate (org.dmg.pmml.SimplePredicateDocument.SimplePredicate)11 SimpleSetPredicate (org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate)9 CompoundPredicate (org.dmg.pmml.CompoundPredicateDocument.CompoundPredicate)8 PMMLCompoundPredicate (org.knime.base.node.mine.decisiontree2.PMMLCompoundPredicate)4 PMMLSimplePredicate (org.knime.base.node.mine.decisiontree2.PMMLSimplePredicate)4 ArrayList (java.util.ArrayList)3 XmlCursor (org.apache.xmlbeans.XmlCursor)3 ScoreDistribution (org.dmg.pmml.ScoreDistributionDocument.ScoreDistribution)3 PMMLFalsePredicate (org.knime.base.node.mine.decisiontree2.PMMLFalsePredicate)3 PMMLSimpleSetPredicate (org.knime.base.node.mine.decisiontree2.PMMLSimpleSetPredicate)3 Entry (java.util.Map.Entry)2 XmlObject (org.apache.xmlbeans.XmlObject)2 SimpleRule (org.dmg.pmml.SimpleRuleDocument.SimpleRule)2 PMMLPredicate (org.knime.base.node.mine.decisiontree2.PMMLPredicate)2 PMMLTruePredicate (org.knime.base.node.mine.decisiontree2.PMMLTruePredicate)2 DecisionTreeNode (org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode)2 DecisionTreeNodeSplitPMML (org.knime.base.node.mine.decisiontree2.model.DecisionTreeNodeSplitPMML)2 DataCell (org.knime.core.data.DataCell)2 File (java.io.File)1 IOException (java.io.IOException)1