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


Java TypeDefinitionField类代码示例

本文整理汇总了Java中org.dmg.pmml.TypeDefinitionField的典型用法代码示例。如果您正苦于以下问题:Java TypeDefinitionField类的具体用法?Java TypeDefinitionField怎么用?Java TypeDefinitionField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: encodeFeatures

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
@Override
public List<Feature> encodeFeatures(SparkMLEncoder encoder){
	RegexTokenizer transformer = getTransformer();

	if(!transformer.getGaps()){
		throw new IllegalArgumentException("Expected splitter mode, got token matching mode");
	} // End if

	if(transformer.getMinTokenLength() != 1){
		throw new IllegalArgumentException("Expected 1 as minimum token length, got " + transformer.getMinTokenLength() + " as minimum token length");
	}

	Feature feature = encoder.getOnlyFeature(transformer.getInputCol());

	TypeDefinitionField field = encoder.getField(feature.getName());

	if(transformer.getToLowercase()){
		Apply apply = PMMLUtil.createApply("lowercase", feature.ref());

		field = encoder.createDerivedField(FeatureUtil.createName("lowercase", feature), OpType.CATEGORICAL, DataType.STRING, apply);
	}

	return Collections.<Feature>singletonList(new DocumentFeature(encoder, field, transformer.getPattern()));
}
 
开发者ID:jpmml,项目名称:jpmml-sparkml,代码行数:25,代码来源:RegexTokenizerConverter.java

示例2: toContinuous

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
public TypeDefinitionField toContinuous(FieldName name){
	TypeDefinitionField field = getField(name);

	DataType dataType = field.getDataType();
	switch(dataType){
		case INTEGER:
		case FLOAT:
		case DOUBLE:
			break;
		default:
			throw new IllegalArgumentException("Field " + name.getValue() + " has data type " + dataType);
	}

	field.setOpType(OpType.CONTINUOUS);

	return field;
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:18,代码来源:PMMLEncoder.java

示例3: toContinuousFeature

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
@Override
public ContinuousFeature toContinuousFeature(){
	PMMLEncoder encoder = ensureEncoder();

	TypeDefinitionField field = encoder.getField(getName());

	DataType dataType = field.getDataType();
	switch(dataType){
		case INTEGER:
		case FLOAT:
		case DOUBLE:
			break;
		default:
			throw new UnsupportedOperationException();
	}

	field.setOpType(OpType.CONTINUOUS);

	return new ContinuousFeature(encoder, field);
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:21,代码来源:CategoricalFeature.java

示例4: createInputValue

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
static
private FieldValue createInputValue(Field field, MiningField miningField, Object value){

	if(value == null){
		return null;
	}

	DataType dataType = field.getDataType();
	OpType opType = getOpType(field, miningField);

	FieldValue fieldValue = createOrRefine(dataType, opType, value);

	if(field instanceof TypeDefinitionField){
		return enhance((TypeDefinitionField)field, fieldValue);
	}

	return fieldValue;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:19,代码来源:FieldValueUtil.java

示例5: createTargetValue

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
static
private FieldValue createTargetValue(Field field, MiningField miningField, Target target, Object value){

	if(value == null){
		return null;
	}

	DataType dataType = field.getDataType();
	OpType opType = getOpType(field, miningField, target);

	FieldValue fieldValue = createOrRefine(dataType, opType, value);

	if(field instanceof TypeDefinitionField){
		return enhance((TypeDefinitionField)field, fieldValue);
	}

	return fieldValue;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:19,代码来源:FieldValueUtil.java

示例6: getOrdering

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
static
private List<?> getOrdering(TypeDefinitionField field, final DataType dataType){
	List<Value> values = getValidValues(field);
	if(values.isEmpty()){
		return null;
	}

	Function<Value, Object> function = new Function<Value, Object>(){

		@Override
		public Object apply(Value value){
			return TypeUtil.parse(dataType, value.getValue());
		}
	};

	return Lists.newArrayList(Iterables.transform(values, function));
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:18,代码来源:FieldValueUtil.java

示例7: load

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
@Override
public List<String> load(TypeDefinitionField field){
	List<Value> values = getValidValues(field);

	Function<Value, String> function = new Function<Value, String>(){

		@Override
		public String apply(Value value){
			String stringValue = value.getValue();
			if(stringValue == null){
				throw new MissingAttributeException(value, PMMLAttributes.VALUE_VALUE);
			}

			return stringValue;
		}
	};

	return ImmutableList.copyOf(Iterables.transform(values, function));
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:20,代码来源:FieldValueUtil.java

示例8: buildColumnCategoryMapping

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
public static Map<Integer, BiMap<String, Integer>> buildColumnCategoryMapping(DataDictionary dictionary) {
  Preconditions.checkNotNull(dictionary);
  InboundSettings settings = InboundSettings.create(ConfigUtils.getDefaultConfig());
  List<String> columnNames = settings.getColumnNames();

  Preconditions.checkNotNull(dictionary);
  Map<Integer,BiMap<String,Integer>> columnToCategoryNameToIDMapping = Maps.newHashMap();
  for (TypeDefinitionField field : dictionary.getDataFields()) {
    Collection<Value> values = field.getValues();
    if (values != null && !values.isEmpty()) {
      String columnName = field.getName().getValue();
      int columnNumber = columnNames.indexOf(columnName);
      BiMap<String,Integer> categoryNameToID = columnToCategoryNameToIDMapping.get(columnNumber);
      if (categoryNameToID == null) {
        categoryNameToID = HashBiMap.create();
        columnToCategoryNameToIDMapping.put(columnNumber, categoryNameToID);
      }
      for (Value value : values) {
        categoryNameToID.put(value.getValue(), categoryNameToID.size());
      }
    }
  }
  return columnToCategoryNameToIDMapping;
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:25,代码来源:PMMLUtils.java

示例9: buildCategoricalValueEncodings

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
public static CategoricalValueEncodings buildCategoricalValueEncodings(
    DataDictionary dictionary) {
  Map<Integer,Collection<String>> indexToValues = new HashMap<>();
  List<DataField> dataFields = dictionary.getDataFields();
  for (int featureIndex = 0; featureIndex < dataFields.size(); featureIndex++) {
    TypeDefinitionField field = dataFields.get(featureIndex);
    Collection<Value> values = field.getValues();
    if (values != null && !values.isEmpty()) {
      Collection<String> categoricalValues = values.stream().map(Value::getValue).collect(Collectors.toList());
      indexToValues.put(featureIndex, categoricalValues);
    }
  }
  return new CategoricalValueEncodings(indexToValues);
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:15,代码来源:AppPMMLUtils.java

示例10: getField

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
public TypeDefinitionField getField(FieldName name){
	DataField dataField = getDataField(name);
	DerivedField derivedField = getDerivedField(name);

	if(dataField != null && derivedField == null){
		return dataField;
	} else

	if(dataField == null && derivedField != null){
		return derivedField;
	}

	throw new IllegalArgumentException(name.getValue());
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:15,代码来源:PMMLEncoder.java

示例11: resolveField

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
protected TypeDefinitionField resolveField(FieldName name){
	TypeDefinitionField result = getDataField(name);

	if(result == null){
		result = resolveDerivedField(name);
	}

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

示例12: getOutputExpression

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
private Expression getOutputExpression(NeuralOutput neuralOutput){
	DerivedField derivedField = neuralOutput.getDerivedField();
	if(derivedField == null){
		throw new MissingElementException(neuralOutput, PMMLElements.NEURALOUTPUT_DERIVEDFIELD);
	}

	Expression expression = ExpressionUtil.ensureExpression(derivedField);

	if(expression instanceof FieldRef){
		FieldRef fieldRef = (FieldRef)expression;

		FieldName name = fieldRef.getField();
		if(name == null){
			throw new MissingAttributeException(fieldRef, PMMLAttributes.FIELDREF_FIELD);
		}

		TypeDefinitionField field = resolveField(name);
		if(field == null){
			throw new MissingFieldException(name, fieldRef);
		} // End if

		if(field instanceof DataField){
			return expression;
		} else

		if(field instanceof DerivedField){
			DerivedField targetDerivedField = (DerivedField)field;

			Expression targetExpression = ExpressionUtil.ensureExpression(targetDerivedField);

			return targetExpression;
		} else

		{
			throw new InvalidAttributeException(fieldRef, PMMLAttributes.FIELDREF_FIELD, name);
		}
	}

	return expression;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:41,代码来源:NeuralNetworkEvaluator.java

示例13: create

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
static
public FieldValue create(Field field, Object value){
	FieldValue result = create(field.getDataType(), field.getOpType(), value);

	if(field instanceof TypeDefinitionField){
		return enhance((TypeDefinitionField)field, result);
	}

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

示例14: refine

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
static
public FieldValue refine(Field field, FieldValue value){
	FieldValue result = refine(field.getDataType(), field.getOpType(), value);

	if((field instanceof TypeDefinitionField) && (result != value)){
		return enhance((TypeDefinitionField)field, result);
	}

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

示例15: enhance

import org.dmg.pmml.TypeDefinitionField; //导入依赖的package包/类
static
private FieldValue enhance(TypeDefinitionField field, FieldValue value){

	if(value instanceof OrdinalValue){
		OrdinalValue ordinalValue = (OrdinalValue)value;

		ordinalValue.setOrdering(getOrdering(field, ordinalValue.getDataType()));
	}

	return value;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:12,代码来源:FieldValueUtil.java


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