Search in sources :

Example 1 with Operator

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

the class TreeModelPMMLTranslator method setValuesFromPMMLSimplePredicate.

private static void setValuesFromPMMLSimplePredicate(final SimplePredicate to, final PMMLSimplePredicate from) {
    to.setField(from.getSplitAttribute());
    Operator.Enum operator;
    final PMMLOperator op = from.getOperator();
    switch(op) {
        case EQUAL:
            operator = Operator.EQUAL;
            to.setValue(from.getThreshold());
            break;
        case GREATER_OR_EQUAL:
            operator = Operator.GREATER_OR_EQUAL;
            to.setValue(from.getThreshold());
            break;
        case GREATER_THAN:
            operator = Operator.GREATER_THAN;
            to.setValue(from.getThreshold());
            break;
        case IS_MISSING:
            operator = Operator.IS_MISSING;
            break;
        case IS_NOT_MISSING:
            operator = Operator.IS_NOT_MISSING;
            break;
        case LESS_OR_EQUAL:
            operator = Operator.LESS_OR_EQUAL;
            to.setValue(from.getThreshold());
            break;
        case LESS_THAN:
            operator = Operator.LESS_THAN;
            to.setValue(from.getThreshold());
            break;
        case NOT_EQUAL:
            operator = Operator.NOT_EQUAL;
            to.setValue(from.getThreshold());
            break;
        default:
            throw new IllegalStateException("Unknown pmml operator \"" + op + "\".");
    }
    to.setOperator(operator);
}
Also used : PMMLOperator(org.knime.base.node.mine.decisiontree2.PMMLOperator) Operator(org.dmg.pmml.SimplePredicateDocument.SimplePredicate.Operator) PMMLBooleanOperator(org.knime.base.node.mine.decisiontree2.PMMLBooleanOperator) PMMLSetOperator(org.knime.base.node.mine.decisiontree2.PMMLSetOperator) Enum(org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate.BooleanOperator.Enum) PMMLOperator(org.knime.base.node.mine.decisiontree2.PMMLOperator)

Example 2 with Operator

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

the class ConditionExporter method setValuesFromPMMLSimplePredicate.

private void setValuesFromPMMLSimplePredicate(final SimplePredicate to, final PMMLSimplePredicate from) {
    to.setField(m_derivedFieldMapper.getDerivedFieldName(from.getSplitAttribute()));
    Operator.Enum operator;
    final PMMLOperator op = from.getOperator();
    switch(op) {
        case EQUAL:
            operator = Operator.EQUAL;
            to.setValue(from.getThreshold());
            break;
        case GREATER_OR_EQUAL:
            operator = Operator.GREATER_OR_EQUAL;
            to.setValue(from.getThreshold());
            break;
        case GREATER_THAN:
            operator = Operator.GREATER_THAN;
            to.setValue(from.getThreshold());
            break;
        case IS_MISSING:
            operator = Operator.IS_MISSING;
            break;
        case IS_NOT_MISSING:
            operator = Operator.IS_NOT_MISSING;
            break;
        case LESS_OR_EQUAL:
            operator = Operator.LESS_OR_EQUAL;
            to.setValue(from.getThreshold());
            break;
        case LESS_THAN:
            operator = Operator.LESS_THAN;
            to.setValue(from.getThreshold());
            break;
        case NOT_EQUAL:
            operator = Operator.NOT_EQUAL;
            to.setValue(from.getThreshold());
            break;
        default:
            throw new IllegalStateException("Unknown pmml operator \"" + op + "\".");
    }
    to.setOperator(operator);
}
Also used : PMMLOperator(org.knime.base.node.mine.decisiontree2.PMMLOperator) Operator(org.dmg.pmml.SimplePredicateDocument.SimplePredicate.Operator) PMMLBooleanOperator(org.knime.base.node.mine.decisiontree2.PMMLBooleanOperator) PMMLSetOperator(org.knime.base.node.mine.decisiontree2.PMMLSetOperator) Enum(org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate.BooleanOperator.Enum) PMMLOperator(org.knime.base.node.mine.decisiontree2.PMMLOperator)

Aggregations

Operator (org.dmg.pmml.SimplePredicateDocument.SimplePredicate.Operator)2 Enum (org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate.BooleanOperator.Enum)2 PMMLBooleanOperator (org.knime.base.node.mine.decisiontree2.PMMLBooleanOperator)2 PMMLOperator (org.knime.base.node.mine.decisiontree2.PMMLOperator)2 PMMLSetOperator (org.knime.base.node.mine.decisiontree2.PMMLSetOperator)2