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


Java DerivedField.getName方法代码示例

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


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

示例1: prepareInputField

import org.dmg.pmml.DerivedField; //导入方法依赖的package包/类
static
private FieldName prepareInputField(FunctionExpression.Argument argument, OpType opType, DataType dataType, RExpEncoder encoder){
	Expression expression = argument.getExpression();

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

		return fieldRef.getField();
	} else

	if(expression instanceof Apply){
		Apply apply = (Apply)expression;

		DerivedField derivedField = encoder.createDerivedField(FieldName.create((argument.formatExpression()).trim()), opType, dataType, apply);

		return derivedField.getName();
	} else

	{
		throw new IllegalArgumentException();
	}
}
 
开发者ID:jpmml,项目名称:jpmml-r,代码行数:23,代码来源:FormulaUtil.java

示例2: encodeFeature

import org.dmg.pmml.DerivedField; //导入方法依赖的package包/类
static
public Feature encodeFeature(Feature feature, Object missingValue, Object replacementValue, MissingValueTreatmentMethod missingValueTreatmentMethod, SkLearnEncoder encoder){
	TypeDefinitionField field = encoder.getField(feature.getName());

	if(field instanceof DataField){
		MissingValueDecorator missingValueDecorator = new MissingValueDecorator()
			.setMissingValueReplacement(ValueUtil.formatValue(replacementValue))
			.setMissingValueTreatment(missingValueTreatmentMethod);

		if(missingValue != null){
			missingValueDecorator.addValues(ValueUtil.formatValue(missingValue));
		}

		encoder.addDecorator(feature.getName(), missingValueDecorator);

		return feature;
	} else

	if(field instanceof DerivedField){
		Expression expression = feature.ref();

		if(missingValue != null){
			expression = PMMLUtil.createApply("equal", expression, PMMLUtil.createConstant(missingValue));
		} else

		{
			expression = PMMLUtil.createApply("isMissing", expression);
		}

		expression = PMMLUtil.createApply("if", expression, PMMLUtil.createConstant(replacementValue), feature.ref());

		DerivedField derivedField = encoder.createDerivedField(FeatureUtil.createName("imputer", feature), expression);

		DataType dataType = derivedField.getDataType();
		switch(dataType){
			case INTEGER:
			case FLOAT:
			case DOUBLE:
				return new ContinuousFeature(encoder, derivedField);
			default:
				return new Feature(encoder, derivedField.getName(), derivedField.getDataType()){

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

	{
		throw new IllegalArgumentException();
	}
}
 
开发者ID:jpmml,项目名称:jpmml-sklearn,代码行数:55,代码来源:ImputerUtil.java

示例3: resolveChained

import org.dmg.pmml.DerivedField; //导入方法依赖的package包/类
@Test
public void resolveChained() throws Exception {
	PMML pmml = ResourceUtil.unmarshal(ChainedSegmentationTest.class);

	FieldDependencyResolver resolver = new FieldDependencyResolver();
	resolver.applyTo(pmml);

	final
	Map<Field, Set<Field>> dependencies = resolver.getDependencies();

	Visitor visitor = new AbstractVisitor(){

		@Override
		public VisitorAction visit(DataField dataField){
			checkFields(Collections.<FieldName>emptySet(), dependencies.get(dataField));

			return super.visit(dataField);
		}

		@Override
		public VisitorAction visit(DerivedField derivedField){
			Set<Field> fields = dependencies.get(derivedField);

			FieldName name = derivedField.getName();

			if("x1_squared".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x1"), fields);
			} else

			if("x1_cubed".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x1", "x1_squared"), fields);
			} else

			if("x2_squared".equals(name.getValue()) || "x2_cubed".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x2"), fields);
			} else

			{
				throw new AssertionError();
			}

			return super.visit(derivedField);
		}

		@Override
		public VisitorAction visit(OutputField outputField){
			checkFields(Collections.<FieldName>emptySet(), dependencies.get(outputField));

			return super.visit(outputField);
		}
	};

	visitor.applyTo(pmml);
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:55,代码来源:FieldDependencyResolverTest.java

示例4: resolveNested

import org.dmg.pmml.DerivedField; //导入方法依赖的package包/类
@Test
public void resolveNested() throws Exception {
	PMML pmml = ResourceUtil.unmarshal(NestedSegmentationTest.class);

	FieldDependencyResolver resolver = new FieldDependencyResolver();
	resolver.applyTo(pmml);

	final
	Map<Field, Set<Field>> dependencies = resolver.getDependencies();

	Visitor visitor = new AbstractVisitor(){

		@Override
		public VisitorAction visit(DerivedField derivedField){
			Set<Field> fields = dependencies.get(derivedField);

			FieldName name = derivedField.getName();

			if("x12".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x1", "x2"), fields);
			} else

			if("x123".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x12", "x3"), fields);
			} else

			if("x1234".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x123", "x4"), fields);
			} else

			if("x12345".equals(name.getValue())){
				checkFields(FieldNameUtil.create("x1234", "x5"), fields);
			} else

			{
				throw new AssertionError();
			}

			return super.visit(derivedField);
		}
	};

	visitor.applyTo(pmml);
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:45,代码来源:FieldDependencyResolverTest.java

示例5: addDerivedField

import org.dmg.pmml.DerivedField; //导入方法依赖的package包/类
public void addDerivedField(DerivedField derivedField){
	FieldName name = derivedField.getName();

	checkName(name);

	this.derivedFields.put(name, derivedField);
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:8,代码来源:PMMLEncoder.java


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