public abstract class ModelEvaluator<M extends org.dmg.pmml.Model> extends ModelManager<M> implements Evaluator
ACTIVE_TYPES, GROUP_TYPES, ORDER_TYPES, TARGET_TYPESDEFAULT_TARGET| Constructor and Description |
|---|
ModelEvaluator(org.dmg.pmml.PMML pmml,
Class<? extends M> clazz) |
ModelEvaluator(org.dmg.pmml.PMML pmml,
M model) |
| Modifier and Type | Method and Description |
|---|---|
Map<org.dmg.pmml.FieldName,?> |
evaluate(Map<org.dmg.pmml.FieldName,?> arguments)
Evaluates the model with the specified arguments.
|
abstract Map<org.dmg.pmml.FieldName,?> |
evaluate(ModelEvaluationContext context) |
protected org.dmg.pmml.DataField |
getDataField() |
org.dmg.pmml.DataField |
getDataField(org.dmg.pmml.FieldName name)
Gets the definition of a field from the
DataDictionary. |
org.dmg.pmml.DefineFunction |
getDefineFunction(String name) |
org.dmg.pmml.DerivedField |
getDerivedField(org.dmg.pmml.FieldName name) |
org.dmg.pmml.DerivedField |
getLocalDerivedField(org.dmg.pmml.FieldName name) |
org.dmg.pmml.MiningField |
getMiningField(org.dmg.pmml.FieldName name)
Gets the definition of a field from the
MiningSchema. |
protected List<org.dmg.pmml.FieldName> |
getMiningFields(EnumSet<org.dmg.pmml.FieldUsageType> types) |
org.dmg.pmml.OutputField |
getOutputField(org.dmg.pmml.FieldName name)
Gets the definition of a field from the
Output
|
List<org.dmg.pmml.FieldName> |
getOutputFields()
Gets the output fields of a
Model from its Output. |
org.dmg.pmml.Target |
getTarget(org.dmg.pmml.FieldName name)
Gets the definition of a field from the
Targets. |
org.dmg.pmml.FieldName |
getTargetField()
Convenience method for retrieving the sole target field.
|
List<org.dmg.pmml.FieldName> |
getTargetFields()
Gets the dependent (ie. target in supervised training) fields of a
Model from its MiningSchema. |
<V> V |
getValue(com.google.common.cache.Cache<M,V> cache,
Callable<? extends V> loader) |
<V> V |
getValue(com.google.common.cache.LoadingCache<M,V> cache) |
FieldValue |
prepare(org.dmg.pmml.FieldName name,
Object value)
Prepares the input value for a field.
|
void |
verify()
Verifies the model.
|
getActiveFields, getGroupFields, getMiningFunction, getModel, getOrderFields, getSummarygetPMMLclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActiveFields, getGroupFields, getMiningFunction, getOrderFields, getSummarypublic ModelEvaluator(org.dmg.pmml.PMML pmml,
M model)
public abstract Map<org.dmg.pmml.FieldName,?> evaluate(ModelEvaluationContext context)
public org.dmg.pmml.DataField getDataField(org.dmg.pmml.FieldName name)
Consumer
Gets the definition of a field from the DataDictionary.
getDataField in interface ConsumergetDataField in interface EvaluatorgetDataField in class PMMLManagername - The name of the field.
Use Evaluator.DEFAULT_TARGET to represent the default target field.protected org.dmg.pmml.DataField getDataField()
DataField describing the default target field.public org.dmg.pmml.DerivedField getDerivedField(org.dmg.pmml.FieldName name)
getDerivedField in class PMMLManagerpublic org.dmg.pmml.DefineFunction getDefineFunction(String name)
getDefineFunction in class PMMLManagerpublic List<org.dmg.pmml.FieldName> getTargetFields()
Consumer
Gets the dependent (ie. target in supervised training) fields of a Model from its MiningSchema.
getTargetFields in interface ConsumergetTargetFields in class ModelManager<M extends org.dmg.pmml.Model>Consumer.getTarget(FieldName)public org.dmg.pmml.FieldName getTargetField()
EvaluatorConvenience method for retrieving the sole target field.
A supervised model should, but is not required to, define a target field.
An unsupervised model, by definition, does not define a target field.
If the collection of target fields is empty,
then the model consumer should assume that the model defines a default target field,
which is represented by Evaluator.DEFAULT_TARGET.
The default target field could be either "real" or "phantom".
They can be distinguished from one another by looking up the definition of the field from the DataDictionary.
Consumer consumer = ...;
List<FieldName> targetFields = consumer.getTargetFields();
if(targetFields.isEmpty()){
FieldName targetField = consumer.getTargetField();
DataField dataField = consumer.getDataField(targetField);
if(dataField != null){
// A "real" default target field
} else
{
// A "phantom" default target field
}
}
getTargetField in interface EvaluatorConsumer.getTargetFields()public org.dmg.pmml.MiningField getMiningField(org.dmg.pmml.FieldName name)
Consumer
Gets the definition of a field from the MiningSchema.
getMiningField in interface ConsumergetMiningField in class ModelManager<M extends org.dmg.pmml.Model>name - The name of the field.Consumer.getActiveFields(),
Consumer.getGroupFields(),
Consumer.getOrderFields(),
Consumer.getTargetFields()protected List<org.dmg.pmml.FieldName> getMiningFields(EnumSet<org.dmg.pmml.FieldUsageType> types)
getMiningFields in class ModelManager<M extends org.dmg.pmml.Model>public org.dmg.pmml.DerivedField getLocalDerivedField(org.dmg.pmml.FieldName name)
getLocalDerivedField in class ModelManager<M extends org.dmg.pmml.Model>public org.dmg.pmml.Target getTarget(org.dmg.pmml.FieldName name)
Consumer
Gets the definition of a field from the Targets.
getTarget in interface ConsumergetTarget in class ModelManager<M extends org.dmg.pmml.Model>Consumer.getTargetFields()public List<org.dmg.pmml.FieldName> getOutputFields()
Consumer
Gets the output fields of a Model from its Output.
getOutputFields in interface ConsumergetOutputFields in class ModelManager<M extends org.dmg.pmml.Model>Consumer.getOutputField(FieldName)public org.dmg.pmml.OutputField getOutputField(org.dmg.pmml.FieldName name)
Consumer
Gets the definition of a field from the Output
getOutputField in interface ConsumergetOutputField in class ModelManager<M extends org.dmg.pmml.Model>Consumer.getOutputFields()public FieldValue prepare(org.dmg.pmml.FieldName name, Object value)
EvaluatorPrepares the input value for a field.
First, the value is converted from the user-supplied representation to internal representation. After that, the value is subjected to missing value treatment, invalid value treatment and outlier treatment.
prepare in interface Evaluatorname - The name of the field.Evaluator.getDataField(FieldName),
Consumer.getMiningField(FieldName)public void verify()
EvaluatorVerifies the model.
public Map<org.dmg.pmml.FieldName,?> evaluate(Map<org.dmg.pmml.FieldName,?> arguments)
EvaluatorEvaluates the model with the specified arguments.
evaluate in interface Evaluatorarguments - Map of active field values.target field and output field values.
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 of Computable that 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 by null.Computablepublic <V> V getValue(com.google.common.cache.LoadingCache<M,V> cache)
Copyright © 2016. All Rights Reserved.