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


Java LocalPolynomialExampleWeightingOperator类代码示例

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


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

示例1: learn

import com.rapidminer.operator.preprocessing.weighting.LocalPolynomialExampleWeightingOperator; //导入依赖的package包/类
@Override
public Model learn(ExampleSet exampleSet) throws OperatorException {
	DistanceMeasure measure = DistanceMeasures.createMeasure(this);
	measure.init(exampleSet);
	GeometricDataCollection<RegressionData> data = new LinearList<RegressionData>(measure);

	// check if weights should be used
	boolean useWeights = getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS);
	// check if robust estimate should be performed: Then calculate weights and use it anyway
	if (getParameterAsBoolean(PARAMETER_USE_ROBUST_ESTIMATION)) {
		useWeights = true;
		LocalPolynomialExampleWeightingOperator weightingOperator;
		try {
			weightingOperator = OperatorService.createOperator(LocalPolynomialExampleWeightingOperator.class);
			exampleSet = weightingOperator.doWork((ExampleSet) exampleSet.clone(), this);
		} catch (OperatorCreationException e) {
			throw new UserError(this, 904, "LocalPolynomialExampleWeighting", e.getMessage());
		}
	}

	Attributes attributes = exampleSet.getAttributes();
	Attribute label = attributes.getLabel();
	Attribute weightAttribute = attributes.getWeight();
	for (Example example : exampleSet) {
		double[] values = new double[attributes.size()];
		double labelValue = example.getValue(label);
		double weight = 1d;
		if (weightAttribute != null && useWeights) {
			weight = example.getValue(weightAttribute);
		}

		// filter out examples without influence
		if (weight > 0d) {
			// copying example values
			int i = 0;
			for (Attribute attribute : attributes) {
				values[i] = example.getValue(attribute);
				i++;
			}

			// inserting into geometric data collection
			data.add(values, new RegressionData(values, labelValue, weight));
		}
	}
	return new LocalPolynomialRegressionModel(exampleSet, data, Neighborhoods.createNeighborhood(this),
			SmoothingKernels.createKernel(this), getParameterAsInt(PARAMETER_DEGREE),
			getParameterAsDouble(PARAMETER_RIDGE));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:49,代码来源:LocalPolynomialRegressionOperator.java

示例2: learn

import com.rapidminer.operator.preprocessing.weighting.LocalPolynomialExampleWeightingOperator; //导入依赖的package包/类
@Override
public Model learn(ExampleSet exampleSet) throws OperatorException {
	DistanceMeasure measure = DistanceMeasures.createMeasure(this);
	measure.init(exampleSet, this);
	GeometricDataCollection<RegressionData> data = new LinearList<RegressionData>(measure);

	// check if weights should be used
	boolean useWeights = getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS);
	// check if robust estimate should be performed: Then calculate weights and use it anyway
	if (getParameterAsBoolean(PARAMETER_USE_ROBUST_ESTIMATION)) {
		useWeights = true;
		LocalPolynomialExampleWeightingOperator weightingOperator;
		try {
			weightingOperator = OperatorService.createOperator(LocalPolynomialExampleWeightingOperator.class);
			exampleSet = weightingOperator.doWork((ExampleSet) exampleSet.clone(), this);
		} catch (OperatorCreationException e) {
			throw new UserError(this, 904, "LocalPolynomialExampleWeighting", e.getMessage());
		}
	}

	Attributes attributes = exampleSet.getAttributes();
	Attribute label = attributes.getLabel();
	Attribute weightAttribute = attributes.getWeight();
	for (Example example : exampleSet) {
		double[] values = new double[attributes.size()];
		double labelValue = example.getValue(label);
		double weight = 1d;
		if (weightAttribute != null && useWeights) {
			weight = example.getValue(weightAttribute);
		}

		// filter out examples without influence
		if (weight > 0d) {
			// copying example values
			int i = 0;
			for (Attribute attribute : attributes) {
				values[i] = example.getValue(attribute);
				i++;
			}

			// inserting into geometric data collection
			data.add(values, new RegressionData(values, labelValue, weight));
		}
	}
	return new LocalPolynomialRegressionModel(exampleSet, data, Neighborhoods.createNeighborhood(this),
			SmoothingKernels.createKernel(this), getParameterAsInt(PARAMETER_DEGREE),
			getParameterAsDouble(PARAMETER_RIDGE));
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:49,代码来源:LocalPolynomialRegressionOperator.java

示例3: learn

import com.rapidminer.operator.preprocessing.weighting.LocalPolynomialExampleWeightingOperator; //导入依赖的package包/类
@Override
public Model learn(ExampleSet exampleSet) throws OperatorException {
	DistanceMeasure measure = DistanceMeasures.createMeasure(this);
	measure.init(exampleSet);
	GeometricDataCollection<RegressionData> data = new LinearList<RegressionData>(measure);

	// check if weights should be used
	boolean useWeights = getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS);
	// check if robust estimate should be performed: Then calculate weights and use it anyway
	if (getParameterAsBoolean(PARAMETER_USE_ROBUST_ESTIMATION)) {
		useWeights = true;
		LocalPolynomialExampleWeightingOperator weightingOperator;
		try {
			weightingOperator = OperatorService.createOperator(LocalPolynomialExampleWeightingOperator.class);
			exampleSet = weightingOperator.doWork((ExampleSet) exampleSet.clone(), this);
		} catch (OperatorCreationException e) {
			throw new UserError(this, 904, "LocalPolynomialExampleWeighting", e.getMessage());
		}
	}

	Attributes attributes = exampleSet.getAttributes();
	Attribute label = attributes.getLabel();
	Attribute weightAttribute = attributes.getWeight();
	for (Example example : exampleSet) {
		double[] values = new double[attributes.size()];
		double labelValue = example.getValue(label);
		double weight = 1d;
		if (weightAttribute != null && useWeights)
			weight = example.getValue(weightAttribute);

		// filter out examples without influence
		if (weight > 0d) {
			// copying example values
			int i = 0;
			for (Attribute attribute : attributes) {
				values[i] = example.getValue(attribute);
				i++;
			}

			// inserting into geometric data collection
			data.add(values, new RegressionData(values, labelValue, weight));
		}
	}
	return new LocalPolynomialRegressionModel(exampleSet, data, Neighborhoods.createNeighborhood(this), SmoothingKernels.createKernel(this), getParameterAsInt(PARAMETER_DEGREE), getParameterAsDouble(PARAMETER_RIDGE));
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:46,代码来源:LocalPolynomialRegressionOperator.java


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