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


Java AnovaCalculator.setAlpha方法代码示例

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


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

示例1: performSignificanceTest

import com.rapidminer.tools.math.AnovaCalculator; //导入方法依赖的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.AnovaCalculator; //导入方法依赖的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: apply

import com.rapidminer.tools.math.AnovaCalculator; //导入方法依赖的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

示例4: apply

import com.rapidminer.tools.math.AnovaCalculator; //导入方法依赖的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.AnovaCalculator.setAlpha方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。