All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mml-models-tree-model.8.38.0.Final.source-code.KiePMMLNodeTemplate.tmpl Maven / Gradle / Ivy

There is a newer version: 9.44.0.Final
Show newest version
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