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


Java DefaultLearner类代码示例

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


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

示例1: learn

import com.rapidminer.operator.learner.lazy.DefaultLearner; //导入依赖的package包/类
@Override
public Model learn(ExampleSet exampleSet) throws OperatorException {
	// create temporary label attribute
	ExampleSet workingExampleSet = (ExampleSet) exampleSet.clone();
	Attribute originalLabel = workingExampleSet.getAttributes().getLabel();
	Attribute workingLabel = AttributeFactory.createAttribute(originalLabel, "working_label");
	workingExampleSet.getExampleTable().addAttribute(workingLabel);
	workingExampleSet.getAttributes().addRegular(workingLabel);
	for (Example example : workingExampleSet) {
		example.setValue(workingLabel, example.getValue(originalLabel));
	}
	workingExampleSet.getAttributes().remove(workingLabel);
	workingExampleSet.getAttributes().setLabel(workingLabel);

	// apply default model and calculate residuals
	DefaultLearner defaultLearner = null;
	try {
		defaultLearner = OperatorService.createOperator(DefaultLearner.class);
	} catch (OperatorCreationException e) {
		throw new OperatorException(getName() + ": not able to create default classifier!", e);
	}
	Model defaultModel = defaultLearner.doWork(workingExampleSet);
	residualReplace(workingExampleSet, defaultModel, false);

	// create residual models
	Model[] residualModels = new Model[getParameterAsInt(PARAMETER_ITERATIONS)];
	for (int iteration = 0; iteration < residualModels.length; iteration++) {
		residualModels[iteration] = applyInnerLearner(workingExampleSet);
		residualReplace(workingExampleSet, residualModels[iteration], true);
	}

	// clean up working label
	workingExampleSet.getAttributes().remove(workingLabel);
	workingExampleSet.getExampleTable().removeAttribute(workingLabel);

	// create and return model
	return new AdditiveRegressionModel(exampleSet, defaultModel, residualModels,
			getParameterAsDouble(PARAMETER_SHRINKAGE));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:40,代码来源:AdditiveRegression.java

示例2: learn

import com.rapidminer.operator.learner.lazy.DefaultLearner; //导入依赖的package包/类
public Model learn(ExampleSet exampleSet) throws OperatorException {
	// create temporary label attribute
	ExampleSet workingExampleSet = (ExampleSet) exampleSet.clone();
	Attribute originalLabel = workingExampleSet.getAttributes().getLabel();
	Attribute workingLabel = AttributeFactory.createAttribute(originalLabel, "working_label");
	workingExampleSet.getExampleTable().addAttribute(workingLabel);
	workingExampleSet.getAttributes().addRegular(workingLabel);
	for (Example example : workingExampleSet) {
		example.setValue(workingLabel, example.getValue(originalLabel));
	}
	workingExampleSet.getAttributes().remove(workingLabel);
	workingExampleSet.getAttributes().setLabel(workingLabel);

	// apply default model and calculate residuals
	DefaultLearner defaultLearner = null;
	try {
		defaultLearner = OperatorService.createOperator(DefaultLearner.class);
	} catch (OperatorCreationException e) {
		throw new OperatorException(getName() + ": not able to create default classifier!", e);
	}
	Model defaultModel = defaultLearner.doWork(workingExampleSet);
	residualReplace(workingExampleSet, defaultModel, false);

	// create residual models
	Model[] residualModels = new Model[getParameterAsInt(PARAMETER_ITERATIONS)];
	for (int iteration = 0; iteration < residualModels.length; iteration++) {
		residualModels[iteration] = applyInnerLearner(workingExampleSet);
		residualReplace(workingExampleSet, residualModels[iteration], true);
	}

	// clean up working label
	workingExampleSet.getAttributes().remove(workingLabel);
	workingExampleSet.getExampleTable().removeAttribute(workingLabel);

	// create and return model
	return new AdditiveRegressionModel(exampleSet, defaultModel, residualModels, getParameterAsDouble(PARAMETER_SHRINKAGE));
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:38,代码来源:AdditiveRegression.java


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