Java Code Examples for org.dmg.pmml.NormDiscrete#Method

The following examples show how to use org.dmg.pmml.NormDiscrete#Method . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpressionUtil.java    From jpmml-evaluator with GNU Affero General Public License v3.0 6 votes vote down vote up
static
public FieldValue evaluateNormDiscrete(NormDiscrete normDiscrete, EvaluationContext context){
	FieldValue value = context.evaluate(ensureField(normDiscrete));

	if(FieldValueUtil.isMissing(value)){
		return FieldValueUtil.create(TypeInfos.CATEGORICAL_DOUBLE, normDiscrete.getMapMissingTo());
	}

	NormDiscrete.Method method = normDiscrete.getMethod();
	switch(method){
		case INDICATOR:
			{
				boolean equals = value.equals(normDiscrete);

				return (equals ? FieldValues.CATEGORICAL_DOUBLE_ONE : FieldValues.CATEGORICAL_DOUBLE_ZERO);
			}
		default:
			throw new UnsupportedAttributeException(normDiscrete, method);
	}
}
 
Example 2
Source File: UnsupportedMarkupInspector.java    From jpmml-evaluator with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public VisitorAction visit(NormDiscrete normDiscrete){
	NormDiscrete.Method method = normDiscrete.getMethod();

	switch(method){
		case THERMOMETER:
			report(new UnsupportedAttributeException(normDiscrete, method));
			break;
		default:
			break;
	}

	return super.visit(normDiscrete);
}