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


Java DataField.getDataType方法代码示例

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


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

示例1: prepareTargetValue

import org.dmg.pmml.DataField; //导入方法依赖的package包/类
static
public FieldValue prepareTargetValue(DataField dataField, MiningField miningField, Target target, Object value){
	DataType dataType = dataField.getDataType();
	OpType opType = dataField.getOpType();

	if(dataType == null || opType == null){
		throw new InvalidElementException(dataField);
	} // End if

	if(miningField != null){
		String invalidValueReplacement = miningField.getInvalidValueReplacement();
		if(invalidValueReplacement != null){
			throw new MisplacedAttributeException(miningField, PMMLAttributes.MININGFIELD_INVALIDVALUEREPLACEMENT, invalidValueReplacement);
		}

		String missingValueReplacement = miningField.getMissingValueReplacement();
		if(missingValueReplacement != null){
			throw new MisplacedAttributeException(miningField, PMMLAttributes.MININGFIELD_MISSINGVALUEREPLACEMENT, missingValueReplacement);
		}
	}

	return createTargetValue(dataField, miningField, target, value);
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:24,代码来源:FieldValueUtil.java

示例2: initializeStruct

import org.dmg.pmml.DataField; //导入方法依赖的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

示例3: initializePrimitiveList

import org.dmg.pmml.DataField; //导入方法依赖的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

示例4: CategoricalLabel

import org.dmg.pmml.DataField; //导入方法依赖的package包/类
public CategoricalLabel(DataField dataField){
	this(dataField.getName(), dataField.getDataType(), PMMLUtil.getValues(dataField));
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:4,代码来源:CategoricalLabel.java

示例5: WildcardFeature

import org.dmg.pmml.DataField; //导入方法依赖的package包/类
public WildcardFeature(PMMLEncoder encoder, DataField dataField){
	super(encoder, dataField.getName(), dataField.getDataType());
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:4,代码来源:WildcardFeature.java

示例6: ContinuousLabel

import org.dmg.pmml.DataField; //导入方法依赖的package包/类
public ContinuousLabel(DataField dataField){
	this(dataField.getName(), dataField.getDataType());
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:4,代码来源:ContinuousLabel.java

示例7: getDataType

import org.dmg.pmml.DataField; //导入方法依赖的package包/类
@Override
public DataType getDataType(){
	DataField dataField = getDataField();

	return dataField.getDataType();
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:7,代码来源:TargetField.java

示例8: processRegressionModel

import org.dmg.pmml.DataField; //导入方法依赖的package包/类
private void processRegressionModel(Model model){
	PMML pmml = getPMML();

	MiningField miningField = getTargetField(model);
	if(miningField == null){
		return;
	}

	FieldName name = miningField.getName();

	DataDictionary dataDictionary = pmml.getDataDictionary();

	DataField dataField = IndexableUtil.find(dataDictionary.getDataFields(), name);
	if(dataField == null){
		throw new MissingFieldException(name, miningField);
	}

	DataType dataType = dataField.getDataType();
	switch(dataType){
		case INTEGER:
			break;
		case FLOAT:
		case DOUBLE:
			return;
		default:
			throw new UnsupportedAttributeException(dataField, dataType);
	}

	Targets targets = model.getTargets();

	if(targets != null){
		Target target = IndexableUtil.find(targets.getTargets(), name);

		if(target != null){

			if(target.getCastInteger() != null){
				return;
			} else

			{
				target.setCastInteger(getCastInteger());
			}
		} else

		{
			targets.addTargets(createTarget(name));
		}
	} else

	{
		targets = new Targets()
			.addTargets(createTarget(name));

		model.setTargets(targets);
	}
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:57,代码来源:RegressionTargetCorrector.java


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