本文整理汇总了Java中org.jpmml.evaluator.Evaluator.getOutputFields方法的典型用法代码示例。如果您正苦于以下问题:Java Evaluator.getOutputFields方法的具体用法?Java Evaluator.getOutputFields怎么用?Java Evaluator.getOutputFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jpmml.evaluator.Evaluator
的用法示例。
在下文中一共展示了Evaluator.getOutputFields方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeResult
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
static
private Tuple storeResult(Evaluator evaluator, Map<FieldName, ?> result){
List<Object> values = Lists.newArrayList();
List<FieldName> targetFields = evaluator.getTargetFields();
for(FieldName targetField : targetFields){
values.add(EvaluatorUtil.decode(result.get(targetField)));
}
List<FieldName> outputFields = evaluator.getOutputFields();
for(FieldName outputField : outputFields){
values.add(result.get(outputField));
}
TupleFactory tupleFactory = TupleFactory.getInstance();
return tupleFactory.newTuple(values);
}
示例2: storeStruct
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
static
private Object[] storeStruct(Evaluator evaluator, Map<FieldName, ?> result){
List<Object> resultStruct = Lists.newArrayList();
List<FieldName> targetFields = evaluator.getTargetFields();
for(FieldName targetField : targetFields){
resultStruct.add(EvaluatorUtil.decode(result.get(targetField)));
}
List<FieldName> outputFields = evaluator.getOutputFields();
for(FieldName outputField : outputFields){
resultStruct.add(result.get(outputField));
}
return resultStruct.toArray(new Object[resultStruct.size()]);
}
示例3: declareOutputFields
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer){
Evaluator evaluator = getEvaluator();
List<String> fields = new ArrayList<>();
List<FieldName> targetFields = evaluator.getTargetFields();
for(FieldName targetField : targetFields){
fields.add(targetField.getValue());
}
List<FieldName> outputFields = evaluator.getOutputFields();
for(FieldName outputField : outputFields){
fields.add(outputField.getValue());
}
declarer.declare(new Fields(fields));
}
示例4: withOutputCols
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
public TransformerBuilder withOutputCols(){
Evaluator evaluator = getEvaluator();
List<OutputField> outputFields = evaluator.getOutputFields();
for(OutputField outputField : outputFields){
this.columnProducers.add(new OutputColumnProducer(outputField, null));
}
return this;
}
示例5: execute
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
@Override
public void execute(Tuple tuple){
Evaluator evaluator = getEvaluator();
Map<FieldName, FieldValue> arguments = new LinkedHashMap<>();
List<FieldName> activeFields = evaluator.getActiveFields();
for(FieldName activeField : activeFields){
FieldValue value = EvaluatorUtil.prepare(evaluator, activeField, tuple.getValueByField(activeField.getValue()));
arguments.put(activeField, value);
}
Map<FieldName, ?> result = evaluator.evaluate(arguments);
Values values = new Values();
List<FieldName> targetFields = evaluator.getTargetFields();
for(FieldName targetField : targetFields){
Object targetValue = result.get(targetField);
values.add(EvaluatorUtil.decode(targetValue));
}
List<FieldName> outputFields = evaluator.getOutputFields();
for(FieldName outputField : outputFields){
Object outputValue = result.get(outputField);
values.add(outputValue);
}
OutputCollector collector = getCollector();
collector.emit(tuple, values);
collector.ack(tuple);
}
示例6: getOutputFields
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
static
public Fields getOutputFields(Evaluator evaluator){
Fields result = new Fields();
List<FieldName> outputFields = evaluator.getOutputFields();
for(FieldName outputField : outputFields){
OutputField field = evaluator.getOutputField(outputField);
result = result.append(createFields(outputField.getValue(), field));
}
return result;
}
示例7: withProbabilityCol
import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
public TransformerBuilder withProbabilityCol(String columnName, List<String> labels){
Evaluator evaluator = getEvaluator();
List<TargetField> targetFields = evaluator.getTargetFields();
if(targetFields.size() != 1){
throw new IllegalArgumentException();
}
TargetField targetField = targetFields.get(0);
List<String> values = new ArrayList<>();
List<OutputField> outputFields = evaluator.getOutputFields();
for(OutputField outputField : outputFields){
org.dmg.pmml.OutputField pmmlOutputField = outputField.getOutputField();
ResultFeature resultFeature = pmmlOutputField.getResultFeature();
switch(resultFeature){
case PROBABILITY:
String value = pmmlOutputField.getValue();
if(value != null){
values.add(value);
}
break;
default:
break;
}
}
if(values.isEmpty()){
throw new IllegalArgumentException();
} // End if
if(labels != null && (labels.size() != values.size() || !labels.containsAll(values))){
throw new IllegalArgumentException();
}
this.columnProducers.add(new ProbabilityColumnProducer(targetField, columnName, labels != null ? labels : values));
return this;
}