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


Java OutputField类代码示例

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


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

示例1: doGetOutputFieldsForPMMLStream

import org.dmg.pmml.OutputField; //导入依赖的package包/类
private List<MLModelField> doGetOutputFieldsForPMMLStream(String pmmlContents) throws SAXException, JAXBException {
    List<MLModelField> fieldNames = new ArrayList<>();
    PMMLManager pmmlManager = new PMMLManager(IOUtil.unmarshal(new ByteArrayInputStream(pmmlContents.getBytes())));
    Evaluator modelEvaluator = (ModelEvaluator<?>) pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());
    modelEvaluator.getPredictedFields().forEach((f) -> fieldNames.add(getModelField(modelEvaluator.getDataField(f))));

    modelEvaluator.getOutputFields().forEach((f) -> {
        OutputField outputField = modelEvaluator.getOutputField(f);
        ResultFeatureType resultFeatureType = outputField.getFeature();
        if (resultFeatureType != ResultFeatureType.PREDICTED_VALUE &&
                resultFeatureType != ResultFeatureType.PREDICTED_DISPLAY_VALUE) {
            fieldNames.add(getModelField(outputField));
        }
    });

    return fieldNames;
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:18,代码来源:MLModelRegistryService.java

示例2: doGetOutputFieldsForPMMLStream

import org.dmg.pmml.OutputField; //导入依赖的package包/类
private List<MLModelField> doGetOutputFieldsForPMMLStream(String pmmlContents) throws SAXException, JAXBException, UnsupportedEncodingException {
    List<MLModelField> fieldNames = new ArrayList<>();
    PMMLManager pmmlManager = new PMMLManager(IOUtil.unmarshal(new ByteArrayInputStream(pmmlContents.getBytes("UTF-8"))));
    Evaluator modelEvaluator = (ModelEvaluator<?>) pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());
    modelEvaluator.getPredictedFields().forEach((f) -> fieldNames.add(getModelField(modelEvaluator.getDataField(f))));

    modelEvaluator.getOutputFields().forEach((f) -> {
        OutputField outputField = modelEvaluator.getOutputField(f);
        ResultFeatureType resultFeatureType = outputField.getFeature();
        if (resultFeatureType != ResultFeatureType.PREDICTED_VALUE &&
                resultFeatureType != ResultFeatureType.PREDICTED_DISPLAY_VALUE) {
            fieldNames.add(getModelField(outputField));
        }
    });

    return fieldNames;
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:18,代码来源:MLModelRegistryService.java

示例3: registerOutputFields

import org.dmg.pmml.OutputField; //导入依赖的package包/类
@Override
public List<OutputField> registerOutputFields(Label label, SparkMLEncoder encoder){
	T model = getTransformer();

	String predictionCol = model.getPredictionCol();

	OutputField predictedField = ModelUtil.createPredictedField(FieldName.create(predictionCol), DataType.STRING, OpType.CATEGORICAL);

	Feature feature = new Feature(encoder, predictedField.getName(), predictedField.getDataType()){

		@Override
		public ContinuousFeature toContinuousFeature(){
			throw new UnsupportedOperationException();
		}
	};

	encoder.putOnlyFeature(predictionCol, feature);

	return Collections.singletonList(predictedField);
}
 
开发者ID:jpmml,项目名称:jpmml-sparkml,代码行数:21,代码来源:ClusteringModelConverter.java

示例4: registerOutputFields

import org.dmg.pmml.OutputField; //导入依赖的package包/类
@Override
public List<OutputField> registerOutputFields(Label label, SparkMLEncoder encoder){
	List<OutputField> result = super.registerOutputFields(label, encoder);

	MiningFunction miningFunction = getMiningFunction();
	switch(miningFunction){
		case CLASSIFICATION:
			CategoricalLabel categoricalLabel = (CategoricalLabel)label;

			result = new ArrayList<>(result);
			result.addAll(ModelUtil.createProbabilityFields(DataType.DOUBLE, categoricalLabel.getValues()));
			break;
		default:
			break;
	}

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

示例5: createPredictedOutput

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
public Output createPredictedOutput(FieldName name, OpType opType, DataType dataType, Transformation... transformations){
	List<OutputField> outputFields = new ArrayList<>();

	OutputField outputField = new OutputField(name, dataType)
		.setOpType(opType)
		.setResultFeature(ResultFeature.PREDICTED_VALUE)
		.setFinalResult(false);

	outputFields.add(outputField);

	for(Transformation transformation : transformations){
		outputField = new OutputField(transformation.getName(outputField.getName()), transformation.getDataType(outputField.getDataType()))
			.setOpType(transformation.getOpType(outputField.getOpType()))
			.setResultFeature(ResultFeature.TRANSFORMED_VALUE)
			.setFinalResult(transformation.isFinalResult())
			.setExpression(transformation.createExpression(new FieldRef(outputField.getName())));

		outputFields.add(outputField);
	}

	return new Output(outputFields);
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:24,代码来源:ModelUtil.java

示例6: toContinuousFeature

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

	Output output = getOutput();

	OutputField outputField = OutputUtil.getOutputField(output, getName());

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

	outputField.setOpType(OpType.CONTINUOUS);

	return new ContinuousOutputFeature(encoder, output, outputField.getName(), outputField.getDataType());
}
 
开发者ID:jpmml,项目名称:jpmml-sklearn,代码行数:23,代码来源:CategoricalOutputFeature.java

示例7: getOutputField

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
public OutputField getOutputField(Output output, FieldName name){

	if(output.hasOutputFields()){
		List<OutputField> outputFields = output.getOutputFields();

		for(OutputField outputField : outputFields){

			if((name).equals(outputField.getName())){
				return outputField;
			}
		}
	}

	return null;
}
 
开发者ID:jpmml,项目名称:jpmml-sklearn,代码行数:17,代码来源:OutputUtil.java

示例8: visit

import org.dmg.pmml.OutputField; //导入依赖的package包/类
@Override
public VisitorAction visit(OutputField outputField){
	ResultFeature resultFeature = outputField.getResultFeature();

	switch(resultFeature){
		case TRANSFORMED_VALUE:
		case DECISION:
			{
				String segmentId = outputField.getSegmentId();

				if(segmentId != null){
					outputField.setValue(filter(outputField.getValue()));
				}
			}
			break;
		default:
			break;
	}

	return super.visit(outputField);
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:22,代码来源:FieldNameFilterer.java

示例9: resolveField

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
private Field resolveField(FieldName name, MiningModelEvaluationContext context){

	while(context != null){
		OutputField outputField = context.getOutputField(name);
		if(outputField != null){
			return outputField;
		}

		DerivedField localDerivedField = context.getLocalDerivedField(name);
		if(localDerivedField != null){
			return localDerivedField;
		}

		context = context.getParent();
	}

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

示例10: getEntityId

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
private String getEntityId(Object object, OutputField outputField){
	HasEntityId hasEntityId = TypeUtil.cast(HasEntityId.class, object);

	int rank = outputField.getRank();
	if(rank <= 0){
		throw new InvalidAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_RANK, rank);
	} // End if

	if(rank > 1){
		HasEntityIdRanking hasEntityIdRanking = TypeUtil.cast(HasEntityIdRanking.class, object);

		OutputField.RankOrder rankOrder = outputField.getRankOrder();
		switch(rankOrder){
			case DESCENDING:
				break;
			default:
				throw new UnsupportedAttributeException(outputField, rankOrder);
		}

		return getElement(hasEntityIdRanking.getEntityIdRanking(), rank);
	}

	return hasEntityId.getEntityId();
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:26,代码来源:OutputUtil.java

示例11: registerOutputFields

import org.dmg.pmml.OutputField; //导入依赖的package包/类
@Override
public List<OutputField> registerOutputFields(Label label, SparkMLEncoder encoder){
	MultilayerPerceptronClassificationModel model = getTransformer();

	List<OutputField> result = super.registerOutputFields(label, encoder);

	if(!(model instanceof HasProbabilityCol)){
		CategoricalLabel categoricalLabel = (CategoricalLabel)label;

		result = new ArrayList<>(result);
		result.addAll(ModelUtil.createProbabilityFields(DataType.DOUBLE, categoricalLabel.getValues()));
	}

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

示例12: createAffinityField

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
public OutputField createAffinityField(FieldName name, DataType dataType, String value){
	OutputField outputField = new OutputField(name, dataType)
		.setOpType(OpType.CONTINUOUS)
		.setResultFeature(ResultFeature.AFFINITY)
		.setValue(value);

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

示例13: createAffinityFields

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
public List<OutputField> createAffinityFields(final DataType dataType, List<? extends Entity> entities){
	Function<Entity, OutputField> function = new Function<Entity, OutputField>(){

		@Override
		public OutputField apply(Entity entity){
			return createAffinityField(dataType, entity.getId());
		}
	};

	return Lists.newArrayList(Lists.transform(entities, function));
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:13,代码来源:ModelUtil.java

示例14: createEntityIdField

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
public OutputField createEntityIdField(FieldName name){
	OutputField outputField = new OutputField(name, DataType.STRING)
		.setOpType(OpType.CATEGORICAL)
		.setResultFeature(ResultFeature.ENTITY_ID);

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

示例15: createPredictedField

import org.dmg.pmml.OutputField; //导入依赖的package包/类
static
public OutputField createPredictedField(FieldName name, DataType dataType, OpType opType){
	OutputField outputField = new OutputField(name, dataType)
		.setOpType(opType)
		.setResultFeature(ResultFeature.PREDICTED_VALUE);

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


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