本文整理汇总了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);
}
示例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};
}
示例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;
}
示例4: CategoricalLabel
import org.dmg.pmml.DataField; //导入方法依赖的package包/类
public CategoricalLabel(DataField dataField){
this(dataField.getName(), dataField.getDataType(), PMMLUtil.getValues(dataField));
}
示例5: WildcardFeature
import org.dmg.pmml.DataField; //导入方法依赖的package包/类
public WildcardFeature(PMMLEncoder encoder, DataField dataField){
super(encoder, dataField.getName(), dataField.getDataType());
}
示例6: ContinuousLabel
import org.dmg.pmml.DataField; //导入方法依赖的package包/类
public ContinuousLabel(DataField dataField){
this(dataField.getName(), dataField.getDataType());
}
示例7: getDataType
import org.dmg.pmml.DataField; //导入方法依赖的package包/类
@Override
public DataType getDataType(){
DataField dataField = getDataField();
return dataField.getDataType();
}
示例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);
}
}