Package org.jpmml.evaluator
Class ModelEvaluator<M extends org.dmg.pmml.Model>
- java.lang.Object
-
- org.jpmml.evaluator.PMMLManager
-
- org.jpmml.evaluator.ModelManager<M>
-
- org.jpmml.evaluator.ModelEvaluator<M>
-
- All Implemented Interfaces:
java.io.Serializable,Evaluator,HasActiveFields,HasInputFields,HasModel<M>,HasPMML,HasResultFields
- Direct Known Subclasses:
AssociationModelEvaluator,ClusteringModelEvaluator,GeneralRegressionModelEvaluator,JavaModelEvaluator,MiningModelEvaluator,NaiveBayesModelEvaluator,NearestNeighborModelEvaluator,NeuralNetworkEvaluator,RegressionModelEvaluator,RuleSetModelEvaluator,ScorecardEvaluator,SupportVectorMachineModelEvaluator,TimeSeriesModelEvaluator,TreeModelEvaluator
public abstract class ModelEvaluator<M extends org.dmg.pmml.Model> extends ModelManager<M> implements Evaluator
- See Also:
ModelEvaluatorBuilder, Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.jpmml.evaluator.Evaluator
DEFAULT_TARGET_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedModelEvaluator()protectedModelEvaluator(org.dmg.pmml.PMML pmml, M model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanassessParentCompatibility()protected booleanassessPurity()voidconfigure(Configuration configuration)Configures the runtime behaviour of this model evaluator.protected <V extends java.lang.Number>
Classification<java.lang.Object,V>createClassification(ValueMap<java.lang.Object,V> values)ModelEvaluationContextcreateEvaluationContext()protected ConfigurationensureConfiguration()protected ModelEvaluatorFactoryensureModelEvaluatorFactory()protected OutputFilterensureOutputFilter()protected ValueFactory<?>ensureValueFactory()protected ValueFactoryFactoryensureValueFactoryFactory()java.util.Map<java.lang.String,?>evaluate(java.util.Map<java.lang.String,?> arguments)Evaluates the model with the specified arguments.protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateAssociationRules(ValueFactory<V> valueFactory, EvaluationContext context)protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateClassification(ValueFactory<V> valueFactory, EvaluationContext context)protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateClustering(ValueFactory<V> valueFactory, EvaluationContext context)java.util.Map<java.lang.String,?>evaluateInternal(ModelEvaluationContext context)protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateMixed(ValueFactory<V> valueFactory, EvaluationContext context)protected java.util.Map<java.lang.String,?>evaluateOutput(java.util.Map<java.lang.String,?> predictions, ModelEvaluationContext context)protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateRegression(ValueFactory<V> valueFactory, EvaluationContext context)protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateSequences(ValueFactory<V> valueFactory, EvaluationContext context)protected <V extends java.lang.Number>
java.util.Map<java.lang.String,?>evaluateTimeSeries(ValueFactory<V> valueFactory, EvaluationContext context)protected java.util.List<InputField>filterInputFields(java.util.List<InputField> inputFields)protected java.util.List<OutputField>filterOutputFields(java.util.List<OutputField> outputFields)protected java.util.List<TargetField>filterTargetFields(java.util.List<TargetField> targetFields)ConfigurationgetConfiguration()InputMappergetInputMapper()protected intgetNumberOfVisibleFields()ResultMappergetResultMapper()booleanisParentCompatible()Indicates if this model evaluator is compatible with its parent model evaluator.booleanisPure()Indicates if this model evaluator represents a pure function.protected java.util.Map<java.lang.String,?>processArguments(java.util.Map<java.lang.String,?> arguments)protected java.util.Map<java.lang.String,?>processResults(java.util.Map<java.lang.String,?> results)ModelEvaluator<M>verify()Verifies the model.-
Methods inherited from class org.jpmml.evaluator.ModelManager
addResultFeatures, collectResultFeatures, collectSegmentResultFeatures, createInputFields, createInputFields, createMiningSchemaException, createOutputFields, createTargetFields, getActiveFields, getDataField, getDefaultDataField, getInputFields, getLocalDerivedField, getMathContext, getMiningField, getMiningFunction, getModel, getOutputField, getOutputFields, getResultFeatures, getTarget, getTargetField, getTargetFields, getTargetName, getVisibleFields, hasLocalDerivedFields, hasOutputFields, hasResultFeature, resetInputFields, resetResultFields, resolveField, setDefaultDataField
-
Methods inherited from class org.jpmml.evaluator.PMMLManager
getDefineFunction, getDerivedField, getPMML, toImmutableListMap, toImmutableMapMap, toImmutableSetMap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jpmml.evaluator.Evaluator
getMiningFunction, getSummary
-
Methods inherited from interface org.jpmml.evaluator.HasActiveFields
getActiveFields
-
Methods inherited from interface org.jpmml.evaluator.HasInputFields
getInputFields
-
Methods inherited from interface org.jpmml.evaluator.HasResultFields
getOutputFields, getTargetFields
-
-
-
-
Constructor Detail
-
ModelEvaluator
protected ModelEvaluator()
-
ModelEvaluator
protected ModelEvaluator(org.dmg.pmml.PMML pmml, M model)
-
-
Method Detail
-
configure
public void configure(Configuration configuration)
Configures the runtime behaviour of this model evaluator.
Must be called once before the first evaluation. May be called any number of times between subsequent evaluations.
-
isParentCompatible
public boolean isParentCompatible()
Indicates if this model evaluator is compatible with its parent model evaluator.
A parent compatible model evaluator inherits
DataFielddeclarations unchanged, which makes it possible to propagateDataFieldand globalDerivedFieldvalues between evaluation contexts during evaluation.
-
isPure
public boolean isPure()
Indicates if this model evaluator represents a pure function.
A pure model evaluator does not tamper with the evaluation context during evaluation.
-
getNumberOfVisibleFields
protected int getNumberOfVisibleFields()
-
verify
public ModelEvaluator<M> verify()
Description copied from interface:EvaluatorVerifies the model.
-
createEvaluationContext
public ModelEvaluationContext createEvaluationContext()
-
evaluate
public java.util.Map<java.lang.String,?> evaluate(java.util.Map<java.lang.String,?> arguments)
Description copied from interface:EvaluatorEvaluates the model with the specified arguments.
- Specified by:
evaluatein interfaceEvaluator- Parameters:
arguments- Map ofinput fieldvalues.- Returns:
- Map of
target fieldandoutput fieldvalues. A target field could be mapped to a complex value or a simple value. An output field is always mapped to a simple value. Complex values are represented as instances ofComputablethat return simple values. Simple values are represented using the Java equivalents of PMML data types (eg. String, Integer, Float, Double etc.). A missing value is represented bynull. - See Also:
Computable
-
processArguments
protected java.util.Map<java.lang.String,?> processArguments(java.util.Map<java.lang.String,?> arguments)
-
processResults
protected java.util.Map<java.lang.String,?> processResults(java.util.Map<java.lang.String,?> results)
-
filterInputFields
protected java.util.List<InputField> filterInputFields(java.util.List<InputField> inputFields)
- Overrides:
filterInputFieldsin classModelManager<M extends org.dmg.pmml.Model>
-
filterTargetFields
protected java.util.List<TargetField> filterTargetFields(java.util.List<TargetField> targetFields)
- Overrides:
filterTargetFieldsin classModelManager<M extends org.dmg.pmml.Model>
-
filterOutputFields
protected java.util.List<OutputField> filterOutputFields(java.util.List<OutputField> outputFields)
- Overrides:
filterOutputFieldsin classModelManager<M extends org.dmg.pmml.Model>
-
evaluateInternal
public java.util.Map<java.lang.String,?> evaluateInternal(ModelEvaluationContext context)
-
evaluateRegression
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateRegression(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateClassification
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateClassification(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateClustering
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateClustering(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateAssociationRules
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateAssociationRules(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateSequences
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateSequences(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateTimeSeries
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateTimeSeries(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateMixed
protected <V extends java.lang.Number> java.util.Map<java.lang.String,?> evaluateMixed(ValueFactory<V> valueFactory, EvaluationContext context)
-
evaluateOutput
protected java.util.Map<java.lang.String,?> evaluateOutput(java.util.Map<java.lang.String,?> predictions, ModelEvaluationContext context)
-
createClassification
protected <V extends java.lang.Number> Classification<java.lang.Object,V> createClassification(ValueMap<java.lang.Object,V> values)
-
assessParentCompatibility
protected boolean assessParentCompatibility()
-
assessPurity
protected boolean assessPurity()
-
ensureConfiguration
protected Configuration ensureConfiguration()
-
ensureModelEvaluatorFactory
protected ModelEvaluatorFactory ensureModelEvaluatorFactory()
-
ensureValueFactoryFactory
protected ValueFactoryFactory ensureValueFactoryFactory()
-
ensureOutputFilter
protected OutputFilter ensureOutputFilter()
-
ensureValueFactory
protected ValueFactory<?> ensureValueFactory()
-
getConfiguration
public Configuration getConfiguration()
-
getInputMapper
public InputMapper getInputMapper()
-
getResultMapper
public ResultMapper getResultMapper()
-
-