Skip to content

Commit

Permalink
Fixed the post-processing of results
Browse files Browse the repository at this point in the history
If an unsupervised model does not contain an Output element, then the
JPMML-Evaluator library is likely to return its results
in the form of an unmodifiable java.util.Map:
Collections.unmodifiableMap(null, new Computable(){})
  • Loading branch information
vruusmann committed Jul 23, 2015
1 parent c481975 commit 197babd
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -555,13 +555,16 @@ protected EvaluationResponse evaluate(Evaluator evaluator, EvaluationRequest req
}

static
private <V> Map<FieldName, V> replaceNullKey(Map<FieldName, V> result){
private <V> Map<FieldName, V> replaceNullKey(Map<FieldName, V> map){

if(result.containsKey(null)){
if(map.containsKey(null)){
Map<FieldName, V> result = new LinkedHashMap<>(map);
result.put(ModelResource.DEFAULT_NAME, result.remove(null));

return result;
}

return result;
return map;
}

static
Expand Down

0 comments on commit 197babd

Please sign in to comment.