use of org.jpmml.evaluator.OutputField in project openscoring by openscoring.
the class ModelUtil method encodeOutputFields.
private static List<Field> encodeOutputFields(List<OutputField> outputFields) {
Function<OutputField, Field> function = new Function<OutputField, Field>() {
@Override
public Field apply(OutputField outputField) {
FieldName name = outputField.getName();
org.dmg.pmml.OutputField pmmlOutputField = outputField.getOutputField();
Field field = new Field(name.getValue());
field.setName(pmmlOutputField.getDisplayName());
field.setDataType(outputField.getDataType());
field.setOpType(outputField.getOpType());
return field;
}
};
List<Field> fields = new ArrayList<>(Lists.transform(outputFields, function));
return fields;
}
use of org.jpmml.evaluator.OutputField in project openscoring by openscoring.
the class ModelUtil method encodeSchema.
public static Map<String, List<Field>> encodeSchema(Evaluator evaluator) {
Map<String, List<Field>> result = new LinkedHashMap<>();
List<InputField> inputFields = evaluator.getInputFields();
result.put("inputFields", encodeInputFields(inputFields));
List<InputField> groupFields = Collections.emptyList();
if (evaluator instanceof HasGroupFields) {
HasGroupFields hasGroupFields = (HasGroupFields) evaluator;
groupFields = hasGroupFields.getGroupFields();
}
result.put("groupFields", encodeInputFields(groupFields));
List<TargetField> targetFields = evaluator.getTargetFields();
result.put("targetFields", encodeTargetFields(targetFields));
List<OutputField> outputFields = evaluator.getOutputFields();
result.put("outputFields", encodeOutputFields(outputFields));
return result;
}
Aggregations