我使用的是jpmml.evaluator.version 1.3.4&jpmml.model.version 1.3.5。
我准备了评估的参数,但得到了一个错误:org.jpml.evaluator.MissingValueException(第10678行或附近):decisionFunction_1网址:org.jpmml.evaluator.mining.MiningModelEvaluator.evalateSegmentation(MiningModelEvaler.java:436)网址:org.jpmml.evaluator.mining.MiningModelEvaluator.evalateClassification(MiningModelEvaler.java:240)网址:org.jpmml.evaluator.mining.MiningModelEvaluator.eevaluate(MiningModelEvaluator.java:207)网址:org.jpmml.evaluator.mining.MiningModelEvaluator.eevaluate(MiningModelEvaluator.java:185)
代码:
//Feature class has 2 fields: String name, Object value
public Double evaluate(List<Feature> givenFeaturesValue) {
Map<FieldName, FieldValue> arguments = new HashMap<>();
List<InputField> inputFields = evaluator.getInputFields();
Map<FieldName, InputField> featureProperties= new HashMap<>(inputFields.size());
for(InputField inputField : inputFields) {
featureProperties.put(inputField.getName(), inputField);
}
for(Entry<FieldName, InputField> featureProperty: featureProperties.entrySet()) {
FieldValue value = featureProperty.getValue().prepare(null);
arguments.put(featureProperty.getKey(), value);
}
for(Entry<FieldName, InputField> featureProperty: featureProperties.entrySet()) {
for(Feature givenFeature: givenFeaturesValue) {
if(givenFeature.getFieldName().equals(featureProperty.getKey().getValue())) {
FieldValue value = givenFeature.getValue().prepare(featureProperty.getValue());
arguments.put(featureProperty.getKey(), value);
}
}
}
Map<FieldName, ?> results = evaluator.evaluate(arguments);
//after this line I get the error
}
PMML文件:
<DataDictionary>
<DataField name="GENDER" optype="categorical" dataType="string">
<Value value="0"/>
<Value value="1"/>
</DataField>
<DataField name="1GA" optype="categorical" dataType="string">
<Value value="1GA DEFAULT"/>
<Value value=""/>
<Value value="""/>
<Value value="#"/>
<Value value="#NUM#"/>
</DataField>
<DataField name="DB10" optype="categorical" dataType="integer">
<Value value="0"/>
<Value value="1"/>
</DataField>
<DataField name="ILR" optype="continuous" dataType="double"/>
</DataDictionary>
感谢的帮助
只需为此输入字段提供一个非null
值(而不是null
值)。
这个例外是JPMML Evaluator的java.lang.NullPointerException
等价物。你知道如何用Java(和其他基于JVM的语言)处理NPE吗?