use of org.dmg.pmml.PMML in project storm by apache.
the class JpmmlModelOutputs method create.
// ======
private static ModelOutputs create(PMML pmmlModel, List<String> streams) {
final Set<String> fieldNames = new LinkedHashSet<>();
final Evaluator evaluator = JpmmlFactory.newEvaluator(pmmlModel);
for (FieldName predictedField : evaluator.getPredictedFields()) {
fieldNames.add(predictedField.getValue());
}
for (FieldName outputField : evaluator.getOutputFields()) {
fieldNames.add(outputField.getValue());
}
final Map<String, Fields> toDeclare = streams.stream().collect(Collectors.toMap(Function.identity(), (x) -> new Fields(new ArrayList<>(fieldNames))));
return new JpmmlModelOutputs(toDeclare);
}
Aggregations