本文整理汇总了Java中org.dmg.pmml.TypeDefinitionField.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java TypeDefinitionField.getValues方法的具体用法?Java TypeDefinitionField.getValues怎么用?Java TypeDefinitionField.getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dmg.pmml.TypeDefinitionField
的用法示例。
在下文中一共展示了TypeDefinitionField.getValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: getValidValues
import org.dmg.pmml.TypeDefinitionField; //导入方法依赖的package包/类
static
public List<Value> getValidValues(TypeDefinitionField field){
if(field.hasValues()){
List<Value> pmmlValues = field.getValues();
List<Value> result = new ArrayList<>(pmmlValues.size());
for(int i = 0, max = pmmlValues.size(); i < max; i++){
Value pmmlValue = pmmlValues.get(i);
Value.Property property = pmmlValue.getProperty();
switch(property){
case VALID:
result.add(pmmlValue);
break;
case INVALID:
case MISSING:
break;
default:
throw new UnsupportedAttributeException(pmmlValue, property);
}
}
return result;
}
return Collections.emptyList();
}