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


Java MiningFunction.REGRESSION属性代码示例

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


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

示例1: getMiningFunction

static
private MiningFunction getMiningFunction(String family){
	GeneralRegressionModel.Distribution distribution = parseFamily(family);

	switch(distribution){
		case BINOMIAL:
			return MiningFunction.CLASSIFICATION;
		case NORMAL:
		case GAMMA:
		case IGAUSS:
		case POISSON:
			return MiningFunction.REGRESSION;
		default:
			throw new IllegalArgumentException();
	}
}
 
开发者ID:jpmml,项目名称:jpmml-r,代码行数:16,代码来源:GLMConverter.java

示例2: getMiningFunction

@Override
public MiningFunction getMiningFunction(){
	GeneralizedLinearRegressionModel model = getTransformer();

	String family = model.getFamily();
	switch(family){
		case "binomial":
			return MiningFunction.CLASSIFICATION;
		default:
			return MiningFunction.REGRESSION;
	}
}
 
开发者ID:jpmml,项目名称:jpmml-sparkml,代码行数:12,代码来源:GeneralizedLinearRegressionModelConverter.java

示例3: getMiningFunction

@Override
public MiningFunction getMiningFunction(){
	MiningFunction miningFunction = super.getMiningFunction();

	if(miningFunction == null){
		return MiningFunction.REGRESSION;
	}

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

示例4: getMiningFunction

@Override
public MiningFunction getMiningFunction(){
	return MiningFunction.REGRESSION;
}
 
开发者ID:jpmml,项目名称:jpmml-sparkml,代码行数:4,代码来源:RegressionModelConverter.java

示例5: createRegression

static
public SupportVectorMachineModel createRegression(Matrix<Double> sv, List<String> ids, Double rho, List<Double> coefs, Schema schema){
	ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel();

	VectorDictionary vectorDictionary = LibSVMUtil.createVectorDictionary(sv, ids, schema);

	List<VectorInstance> vectorInstances = vectorDictionary.getVectorInstances();

	List<SupportVectorMachine> supportVectorMachines = new ArrayList<>();
	supportVectorMachines.add(LibSVMUtil.createSupportVectorMachine(vectorInstances, rho, coefs));

	SupportVectorMachineModel supportVectorMachineModel = new SupportVectorMachineModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel), vectorDictionary, supportVectorMachines);

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

示例6: encodeResponse

private void encodeResponse(S4Object responses, RExpEncoder encoder){
	RGenericVector variables = (RGenericVector)responses.getAttributeValue("variables");
	RBooleanVector is_nominal = (RBooleanVector)responses.getAttributeValue("is_nominal");
	RGenericVector levels = (RGenericVector)responses.getAttributeValue("levels");

	RStringVector variableNames = variables.names();

	String variableName = variableNames.asScalar();

	DataField dataField;

	Boolean categorical = is_nominal.getValue(variableName);
	if((Boolean.TRUE).equals(categorical)){
		this.miningFunction = MiningFunction.CLASSIFICATION;

		RExp targetVariable = variables.getValue(variableName);

		RStringVector targetVariableClass = (RStringVector)targetVariable.getAttributeValue("class");

		RStringVector targetCategories = (RStringVector)levels.getValue(variableName);

		dataField = encoder.createDataField(FieldName.create(variableName), OpType.CATEGORICAL, RExpUtil.getDataType(targetVariableClass.asScalar()), targetCategories.getValues());
	} else

	if((Boolean.FALSE).equals(categorical)){
		this.miningFunction = MiningFunction.REGRESSION;

		dataField = encoder.createDataField(FieldName.create(variableName), OpType.CONTINUOUS, DataType.DOUBLE);
	} else

	{
		throw new IllegalArgumentException();
	}

	encoder.setLabel(dataField);
}
 
开发者ID:jpmml,项目名称:jpmml-r,代码行数:36,代码来源:BinaryTreeConverter.java

示例7: correct

@Test
public void correct(){
	FieldName name = FieldName.create("y");

	DataField dataField = new DataField(name, OpType.CONTINUOUS, DataType.DOUBLE);

	DataDictionary dataDictionary = new DataDictionary()
		.addDataFields(dataField);

	MiningField miningField = new MiningField(name)
		.setUsageType(MiningField.UsageType.PREDICTED);

	MiningSchema miningSchema = new MiningSchema()
		.addMiningFields(miningField);

	RegressionModel regressionModel = new RegressionModel(MiningFunction.REGRESSION, miningSchema, null);

	PMML pmml = new PMML("4.3", new Header(), dataDictionary)
		.addModels(regressionModel);

	RegressionTargetCorrector corrector = new RegressionTargetCorrector();
	corrector.applyTo(pmml);

	Targets targets = regressionModel.getTargets();

	assertNull(targets);

	dataField.setDataType(DataType.INTEGER);

	corrector.applyTo(pmml);

	targets = regressionModel.getTargets();

	assertNotNull(targets);

	Target target = IndexableUtil.find(targets.getTargets(), name);

	assertNotNull(target);

	assertEquals(Target.CastInteger.ROUND, target.getCastInteger());

	corrector = new RegressionTargetCorrector(Target.CastInteger.FLOOR);
	corrector.applyTo(pmml);

	assertEquals(Target.CastInteger.ROUND, target.getCastInteger());

	target.setCastInteger(null);

	corrector.applyTo(pmml);

	assertEquals(Target.CastInteger.FLOOR, target.getCastInteger());
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:52,代码来源:RegressionTargetCorrectorTest.java


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