public class JPmmlModelRunner extends Object implements PmmlModelRunner<Tuple,Map<org.dmg.pmml.FieldName,Object>,Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue>,Map<org.dmg.pmml.FieldName,?>>
JPMML implementation of PmmlModelRunner
. It extracts the raw inputs from the tuple for all ‘active fields’, and builds a tuple with the predicted scores for the ‘predicted fields’ and ‘output fields’. In this implementation all the declared streams will have the same scored tuple.
The ‘predicted’, ‘active’, and ‘output’ fields are extracted from the PMML model.
Constructor and Description |
---|
JPmmlModelRunner(org.jpmml.evaluator.Evaluator evaluator,
ModelOutputs modelOutputs) |
Modifier and Type | Method and Description |
---|---|
Map<org.dmg.pmml.FieldName,Object> |
extractRawInputs(Tuple tuple)
Extracts from the tuple the raw inputs that are to be scored according to the predictive model.
|
List<org.dmg.pmml.FieldName> |
getActiveFields() |
org.jpmml.evaluator.Evaluator |
getEval() |
ModelOutputs |
getModelOutputs() |
List<org.dmg.pmml.FieldName> |
getOutputFields() |
List<org.dmg.pmml.FieldName> |
getPredictedFields() |
Map<org.dmg.pmml.FieldName,?> |
predictScores(Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue> preProcInputs)
Compute the predicted scores from the pre-processed inputs in the step above
|
Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue> |
preProcessInputs(Map<org.dmg.pmml.FieldName,Object> rawInputs)
Pre process inputs, i.e., remove missing fields, outliers, etc
|
Map<String,List<Object>> |
scoredTuplePerStream(Tuple input)
Creates and returns a map with the predicted scores that are to be emitted on each stream.
|
public JPmmlModelRunner(org.jpmml.evaluator.Evaluator evaluator, ModelOutputs modelOutputs)
public Map<org.dmg.pmml.FieldName,Object> extractRawInputs(Tuple tuple)
PmmlModelRunner
Extracts from the tuple the raw inputs that are to be scored according to the predictive model.
extractRawInputs
in interface PmmlModelRunner<Tuple,Map<org.dmg.pmml.FieldName,Object>,Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue>,Map<org.dmg.pmml.FieldName,?>>
tuple
- source from which to extract raw inputspublic Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue> preProcessInputs(Map<org.dmg.pmml.FieldName,Object> rawInputs)
PmmlModelRunner
Pre process inputs, i.e., remove missing fields, outliers, etc
preProcessInputs
in interface PmmlModelRunner<Tuple,Map<org.dmg.pmml.FieldName,Object>,Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue>,Map<org.dmg.pmml.FieldName,?>>
rawInputs
- that are to be preprocessedpublic Map<org.dmg.pmml.FieldName,?> predictScores(Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue> preProcInputs)
PmmlModelRunner
Compute the predicted scores from the pre-processed inputs in the step above
predictScores
in interface PmmlModelRunner<Tuple,Map<org.dmg.pmml.FieldName,Object>,Map<org.dmg.pmml.FieldName,org.jpmml.evaluator.FieldValue>,Map<org.dmg.pmml.FieldName,?>>
preProcInputs
- that are to be preprocessedpublic Map<String,List<Object>> scoredTuplePerStream(Tuple input)
ModelRunner
Creates and returns a map with the predicted scores that are to be emitted on each stream. The keys of this map are the stream ids, and the values the predicted scores. It’s up to the implementation to guarantee that the streams ids match the stream ids defined in ModelOutputs
. Namely, the set of keys of the Map<String, List<Object>>
returned by this method should be a subset of ModelOutputs.streams()
scoredTuplePerStream
in interface ModelRunner
public org.jpmml.evaluator.Evaluator getEval()
public List<org.dmg.pmml.FieldName> getActiveFields()
public List<org.dmg.pmml.FieldName> getPredictedFields()
public List<org.dmg.pmml.FieldName> getOutputFields()
public ModelOutputs getModelOutputs()
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.