當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。