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


Java Evaluator.getDataField方法代码示例

本文整理汇总了Java中org.jpmml.evaluator.Evaluator.getDataField方法的典型用法代码示例。如果您正苦于以下问题:Java Evaluator.getDataField方法的具体用法?Java Evaluator.getDataField怎么用?Java Evaluator.getDataField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jpmml.evaluator.Evaluator的用法示例。


在下文中一共展示了Evaluator.getDataField方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareArguments

import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
private Map<FieldName, ?> prepareArguments(Evaluator evaluator, double[] inputValues) {
  Map<FieldName, Object> arguments = new LinkedHashMap<FieldName, Object>();
  List<FieldName> activeFields = evaluator.getActiveFields();
  // loop over and prepare each argument
  int idx = 0;
  for (FieldName activeField : activeFields) {
    DataField dataField = evaluator.getDataField(activeField);
    arguments.put(activeField, evaluator.prepare(activeField, inputValues[idx]));
    idx++;
  }
  return arguments;
}
 
开发者ID:DhruvKumar,项目名称:iot-masterclass,代码行数:13,代码来源:SparkPredictionBolt.java

示例2: prepareArguments

import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
public Map<FieldName, ?> prepareArguments(Evaluator evaluator, double[] inputValues) {
  Map<FieldName, Object> arguments = new LinkedHashMap<FieldName, Object>();
  List<FieldName> activeFields = evaluator.getActiveFields();
  // loop over and prepare each argument
  int idx = 0;
  for (FieldName activeField : activeFields) {
    DataField dataField = evaluator.getDataField(activeField);
    arguments.put(activeField, evaluator.prepare(activeField, inputValues[idx]));
    idx++;
  }
  return arguments;
}
 
开发者ID:DhruvKumar,项目名称:iot-masterclass,代码行数:13,代码来源:PredictionBoltJPMML.java

示例3: initializeStruct

import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
static
private ObjectInspector[] initializeStruct(Evaluator evaluator, ObjectInspector inspector) throws UDFArgumentException {
	StructObjectInspector structInspector = (StructObjectInspector)inspector;

	List<FieldName> activeFields = evaluator.getActiveFields();
	for(FieldName activeField : activeFields){
		DataField field = evaluator.getDataField(activeField);

		StructField structField;

		try {
			structField = structInspector.getStructFieldRef(activeField.getValue());
		} catch(Exception e){
			throw new UDFArgumentTypeException(0, "Missing struct field \"" + activeField.getValue() + "\"");
		}

		ObjectInspector structFieldInspector = structField.getFieldObjectInspector();

		ObjectInspector.Category structFieldCategory = structFieldInspector.getCategory();
		switch(structFieldCategory){
			case PRIMITIVE:
				break;
			default:
				throw new UDFArgumentTypeException(0, "Struct field \"" + activeField.getValue() + "\": Expected " + ObjectInspector.Category.PRIMITIVE + " type, got " + structFieldCategory + " type");
		}

		DataType dataType = getDataType(structFieldInspector);
		if(!isConvertible(dataType, field.getDataType())){
			throw new UDFArgumentTypeException(0, "Struct field \"" + activeField.getValue() + "\": Cannot convert " + dataType + " to " + field.getDataType());
		}
	}

	return new ObjectInspector[]{structInspector};
}
 
开发者ID:jpmml,项目名称:jpmml-hive,代码行数:35,代码来源:PMMLUtil.java

示例4: initializePrimitiveList

import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
static
private ObjectInspector[] initializePrimitiveList(Evaluator evaluator, ObjectInspector[] inspectors) throws UDFArgumentException {

	List<FieldName> activeFields = evaluator.getActiveFields();
	if(inspectors.length != activeFields.size()){
		throw new UDFArgumentLengthException("Expected " + activeFields.size() + " arguments, got " + inspectors.length + " arguments");
	}

	int i = 0;

	for(FieldName activeField : activeFields){
		DataField field = evaluator.getDataField(activeField);

		ObjectInspector inspector = inspectors[i];

		ObjectInspector.Category category = inspector.getCategory();
		switch(category){
			case PRIMITIVE:
				break;
			default:
				throw new UDFArgumentTypeException(i, "Expected " + ObjectInspector.Category.PRIMITIVE + " type, got " + category + " type");
		}

		DataType dataType = getDataType(inspector);
		if(!isConvertible(dataType, field.getDataType())){
			throw new UDFArgumentTypeException(i, "Cannot convert " + dataType + " to " + field.getDataType());
		}

		i++;
	}

	return inspectors;
}
 
开发者ID:jpmml,项目名称:jpmml-hive,代码行数:34,代码来源:PMMLUtil.java

示例5: initializeSimpleResult

import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
/**
 * @see #initializeArguments(Class, ObjectInspector[])
 */
static
public PrimitiveObjectInspector initializeSimpleResult(Class<? extends GenericUDF> clazz) throws UDFArgumentException {
	Evaluator evaluator = getEvaluator(clazz);

	FieldName targetField = evaluator.getTargetField();

	DataField field = evaluator.getDataField(targetField);

	return toObjectInspector(field.getDataType());
}
 
开发者ID:jpmml,项目名称:jpmml-hive,代码行数:14,代码来源:PMMLUtil.java

示例6: getDataFields

import org.jpmml.evaluator.Evaluator; //导入方法依赖的package包/类
static
private Fields getDataFields(Evaluator evaluator, List<FieldName> dataFields){
	Fields result = new Fields();

	for(FieldName dataField : dataFields){
		DataField field = evaluator.getDataField(dataField);

		result = result.append(createFields(dataField.getValue(), field));
	}

	return result;
}
 
开发者ID:jpmml,项目名称:jpmml-cascading,代码行数:13,代码来源:FieldsUtil.java


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