當前位置: 首頁>>代碼示例>>Java>>正文


Java SignificanceCalculationException類代碼示例

本文整理匯總了Java中com.rapidminer.tools.math.SignificanceCalculationException的典型用法代碼示例。如果您正苦於以下問題:Java SignificanceCalculationException類的具體用法?Java SignificanceCalculationException怎麽用?Java SignificanceCalculationException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SignificanceCalculationException類屬於com.rapidminer.tools.math包,在下文中一共展示了SignificanceCalculationException類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: performSignificanceTest

import com.rapidminer.tools.math.SignificanceCalculationException; //導入依賴的package包/類
@Override
public SignificanceTestResult performSignificanceTest(PerformanceVector[] allVectors, double alpha)
		throws OperatorException {
	AnovaCalculator calculator = new AnovaCalculator();
	calculator.setAlpha(alpha);

	for (int i = 0; i < allVectors.length; i++) {
		PerformanceCriterion pc = allVectors[i].getMainCriterion();
		calculator.addGroup(pc.getAverageCount(), pc.getAverage(), pc.getVariance());
	}

	try {
		SignificanceTestResult testResult = calculator.performSignificanceTest();
		this.probability = testResult.getProbability();
		return testResult;
	} catch (SignificanceCalculationException e) {
		throw new UserError(this, 920, e.getMessage());
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:20,代碼來源:AnovaSignificanceTestOperator.java

示例2: performSignificanceTest

import com.rapidminer.tools.math.SignificanceCalculationException; //導入依賴的package包/類
@Override
public SignificanceTestResult performSignificanceTest(PerformanceVector[] allVectors, double alpha) throws OperatorException {
	AnovaCalculator calculator = new AnovaCalculator();
	calculator.setAlpha(alpha);

	for (int i = 0; i < allVectors.length; i++) {
		PerformanceCriterion pc = allVectors[i].getMainCriterion();
		calculator.addGroup(pc.getAverageCount(), pc.getAverage(), pc.getVariance());
	}

	try {
		SignificanceTestResult testResult = calculator.performSignificanceTest();
		this.probability = testResult.getProbability();
		return testResult;
	} catch (SignificanceCalculationException e) {
		throw new UserError(this, 920, e.getMessage());
	}
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:19,代碼來源:AnovaSignificanceTestOperator.java

示例3: calculateANOVA

import com.rapidminer.tools.math.SignificanceCalculationException; //導入依賴的package包/類
private void calculateANOVA() throws SignificanceCalculationException {
	double alpha = -1;
	String alphaString = alphaField.getText();
	try {
		alpha = Double.parseDouble(alphaString);
	} catch (NumberFormatException e) {
		SwingTools.showVerySimpleErrorMessage("sign_lvl_between_0_1");
	}

	if ((alpha < 0) || (alpha > 1)) {
		SwingTools.showVerySimpleErrorMessage("sign_lvl_between_0_1");			
	} else {
		this.calculator.clearGroups();
		this.calculator.setAlpha(alpha);
		for (int i = 0; i < tableModel.getRowCount(); i++) {
			double mean = ((Double) tableModel.getValueAt(i, 0)).doubleValue();
			double variance = ((Double) tableModel.getValueAt(i, 1)).doubleValue();
			int number = ((Integer) tableModel.getValueAt(i, 2)).intValue();
			calculator.addGroup(number, mean, variance);
		}
		if (tableModel.getRowCount() < 2) {
			SwingTools.showVerySimpleErrorMessage("two_rows_to_calc_anova_test");
			return;
		}

		SignificanceTestResult result = calculator.performSignificanceTest();
		SwingTools.showResultsDialog("anova", ResultDisplayTools.createVisualizationComponent(result, null, "ANOVA Result"));
	}
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:30,代碼來源:AnovaCalculatorDialog.java

示例4: apply

import com.rapidminer.tools.math.SignificanceCalculationException; //導入依賴的package包/類
public SignificanceTestResult apply(ExampleSet exampleSet) throws OperatorException {
	// init and checks
	String attributeName = getParameterAsString(PARAMETER_ANOVA_ATTRIBUTE);
	String groupByAttributeName = getParameterAsString(PARAMETER_GROUP_BY_ATTRIBUTE);
	boolean onlyDistinct = getParameterAsBoolean(PARAMETER_ONLY_DISTINCT);

	Attribute anovaAttribute = exampleSet.getAttributes().get(attributeName);
	if (anovaAttribute == null) {
		throw new AttributeNotFoundError(this, PARAMETER_ANOVA_ATTRIBUTE,
				getParameterAsString(PARAMETER_ANOVA_ATTRIBUTE));
	}
	if (anovaAttribute.isNominal()) {
		throw new UserError(this, 104, new Object[] { "anova calculation",
				this.getParameterAsString(PARAMETER_ANOVA_ATTRIBUTE) });
	}

	Attribute groupByAttribute = exampleSet.getAttributes().get(groupByAttributeName);
	if (groupByAttribute == null) {
		throw new AttributeNotFoundError(this, PARAMETER_GROUP_BY_ATTRIBUTE,
				getParameterAsString(PARAMETER_GROUP_BY_ATTRIBUTE));
	}
	if (!groupByAttribute.isNominal()) {
		throw new UserError(this, 103, new Object[] { "the parameter grouping by",
				this.getParameterAsString(PARAMETER_GROUP_BY_ATTRIBUTE) });
	}

	// create anova calculator
	AnovaCalculator anovaCalculator = new AnovaCalculator();
	double alpha = getParameterAsDouble(PARAMETER_SIGNIFICANCE_LEVEL);
	anovaCalculator.setAlpha(alpha);

	// add groups
	SplittedExampleSet grouped = SplittedExampleSet.splitByAttribute(exampleSet, groupByAttribute);
	AggregationFunction meanFunction = new AverageFunction();
	AggregationFunction varianceFunction = new VarianceFunction();
	for (int i = 0; i < grouped.getNumberOfSubsets(); i++) {
		grouped.selectSingleSubset(i);
		double[] values = getValues(grouped, anovaAttribute, onlyDistinct);
		double mean = meanFunction.calculate(values);
		double variance = varianceFunction.calculate(values);
		anovaCalculator.addGroup(grouped.size(), mean, variance);
	}

	// calculate and return result
	SignificanceTestResult result = null;
	try {
		result = anovaCalculator.performSignificanceTest();
	} catch (SignificanceCalculationException e) {
		throw new UserError(this, 920, e.getMessage());
	}

	exampleSetOutput.deliver(exampleSet);

	return result;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:56,代碼來源:GroupedANOVAOperator.java

示例5: apply

import com.rapidminer.tools.math.SignificanceCalculationException; //導入依賴的package包/類
public SignificanceTestResult apply(ExampleSet exampleSet) throws OperatorException {
	// init and checks
	String attributeName = getParameterAsString(PARAMETER_ANOVA_ATTRIBUTE);
	String groupByAttributeName = getParameterAsString(PARAMETER_GROUP_BY_ATTRIBUTE);
	boolean onlyDistinct = getParameterAsBoolean(PARAMETER_ONLY_DISTINCT);

	Attribute anovaAttribute = exampleSet.getAttributes().get(attributeName);
	if (anovaAttribute == null) {
		throw new UserError(this, 111, this.getParameterAsString(PARAMETER_ANOVA_ATTRIBUTE));
	}
	if (anovaAttribute.isNominal()) {
		throw new UserError(this, 104, new Object[] { "anova calculation", this.getParameterAsString(PARAMETER_ANOVA_ATTRIBUTE)});
	}

	Attribute groupByAttribute = exampleSet.getAttributes().get(groupByAttributeName);
	if (groupByAttribute == null) {
		throw new UserError(this, 111, this.getParameterAsString(PARAMETER_GROUP_BY_ATTRIBUTE));
	}
	if (!groupByAttribute.isNominal()) {
		throw new UserError(this, 103, new Object[] {"the parameter grouping by", this.getParameterAsString(PARAMETER_GROUP_BY_ATTRIBUTE)});
	}

	// create anova calculator
	AnovaCalculator anovaCalculator = new AnovaCalculator();
	double alpha = getParameterAsDouble(PARAMETER_SIGNIFICANCE_LEVEL);
	anovaCalculator.setAlpha(alpha);

	// add groups
	SplittedExampleSet grouped = SplittedExampleSet.splitByAttribute(exampleSet, groupByAttribute);
	AggregationFunction meanFunction = new AverageFunction();
	AggregationFunction varianceFunction = new VarianceFunction();
	for (int i = 0; i < grouped.getNumberOfSubsets(); i++) {
		grouped.selectSingleSubset(i);
		double[] values = getValues(grouped, anovaAttribute, onlyDistinct);
		double mean = meanFunction.calculate(values);
		double variance = varianceFunction.calculate(values);
		anovaCalculator.addGroup(grouped.size(), mean, variance);
	}

	// calculate and return result
	SignificanceTestResult result = null;
	try {
		result = anovaCalculator.performSignificanceTest();
	} catch (SignificanceCalculationException e) {
		throw new UserError(this, 920, e.getMessage());
	}

	exampleSetOutput.deliver(exampleSet);

	return result;
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:52,代碼來源:GroupedANOVAOperator.java


注:本文中的com.rapidminer.tools.math.SignificanceCalculationException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。