mml-models-tree-model.8.41.0.Final.source-code.KiePMMLNodeTemplate.tmpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kie-pmml-models-tree-model Show documentation
Show all versions of kie-pmml-models-tree-model Show documentation
KiePMML Model for Tree implementation
package org.kie.pmml.models.tree.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import org.kie.pmml.commons.model.KiePMMLOutputField;
import org.kie.pmml.commons.model.predicates.KiePMMLCompoundPredicate;
import org.kie.pmml.commons.model.predicates.KiePMMLFalsePredicate;
import org.kie.pmml.commons.model.predicates.KiePMMLPredicate;
import org.kie.pmml.commons.model.predicates.KiePMMLSimplePredicate;
import org.kie.pmml.commons.model.predicates.KiePMMLSimpleSetPredicate;
import org.kie.pmml.commons.model.predicates.KiePMMLTruePredicate;
import org.kie.pmml.api.enums.PMML_MODEL;
import org.kie.pmml.models.tree.model.KiePMMLNode;
import org.kie.pmml.models.tree.model.KiePMMLNodeResult;
import org.kie.pmml.models.tree.model.KiePMMLScoreDistribution;
public class KiePMMLNodeTemplate extends KiePMMLNode {
public KiePMMLNodeTemplate() {
super(name, Collections.emptyList());
}
public static KiePMMLNodeResult evaluateNode(final Map requestData) {
if (!predicate.evaluate(requestData)) {
return null;
}
final List, KiePMMLNodeResult>> nodeFunctions = null;
final Object score = null;
final List scoreDistributions = null;
final double missingValuePenalty = 1.0;
KiePMMLNodeResult kiePMMLNodeResult = new KiePMMLNodeResult(score, KiePMMLNode.getProbabilityConfidenceMap(scoreDistributions, missingValuePenalty));
if (nodeFunctions.isEmpty()) {
return kiePMMLNodeResult;
}
Optional nestedKiePMMLNodeResult = KiePMMLNode.getNestedKiePMMLNodeResult(nodeFunctions, requestData);
return nestedKiePMMLNodeResult.orElse(kiePMMLNodeResult);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy