当前位置: 首页>>代码示例>>Java>>正文


Java Evaluator.getOutputFields方法代码示例

本文整理汇总了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);
}
 
开发者ID:jpmml,项目名称:jpmml-pig,代码行数:19,代码来源:PMMLUtil.java

示例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()]);
}
 
开发者ID:jpmml,项目名称:jpmml-hive,代码行数:17,代码来源:PMMLUtil.java

示例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));
}
 
开发者ID:jpmml,项目名称:jpmml-storm,代码行数:19,代码来源:PMMLBolt.java

示例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;
}
 
开发者ID:jeremyore,项目名称:spark-pmml-import,代码行数:11,代码来源:TransformerBuilder.java

示例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);
}
 
开发者ID:jpmml,项目名称:jpmml-storm,代码行数:37,代码来源:PMMLBolt.java

示例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;
}
 
开发者ID:jpmml,项目名称:jpmml-cascading,代码行数:14,代码来源:FieldsUtil.java

示例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;
}
 
开发者ID:jeremyore,项目名称:spark-pmml-import,代码行数:43,代码来源:TransformerBuilder.java


注:本文中的org.jpmml.evaluator.Evaluator.getOutputFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。