本文整理汇总了Java中com.rapidminer.tools.math.SignificanceTestResult类的典型用法代码示例。如果您正苦于以下问题:Java SignificanceTestResult类的具体用法?Java SignificanceTestResult怎么用?Java SignificanceTestResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SignificanceTestResult类属于com.rapidminer.tools.math包,在下文中一共展示了SignificanceTestResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doWork
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
/** Writes the attribute set to a file. */
@Override
public void doWork() throws OperatorException {
List<PerformanceVector> allVectors = performanceExtender.getData(PerformanceVector.class);
if (allVectors.size() < getMinSize()) {
throw new UserError(this, 123, PerformanceVector.class, getMinSize() + "");
}
if (allVectors.size() > getMaxSize()) {
throw new UserError(this, 124, PerformanceVector.class, getMaxSize() + "");
}
PerformanceVector[] allVectorsArray = new PerformanceVector[allVectors.size()];
allVectors.toArray(allVectorsArray);
// // create result array
// IOObject[] resultArray = new IOObject[allVectors.size() + 1];
// System.arraycopy(allVectorsArray, 0, resultArray, 0, allVectorsArray.length);
SignificanceTestResult result = performSignificanceTest(allVectorsArray, getParameterAsDouble(PARAMETER_ALPHA));
performanceExtender.passDataThrough();
significanceOutput.deliver(result);
}
示例2: performSignificanceTest
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的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());
}
}
示例3: doWork
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
/** Writes the attribute set to a file. */
@Override
public void doWork() throws OperatorException {
List<PerformanceVector> allVectors = performanceExtender.getData(PerformanceVector.class);
if (allVectors.size() < getMinSize()) {
throw new UserError(this, 123, PerformanceVector.class, getMinSize() + "");
}
if (allVectors.size() > getMaxSize()) {
throw new UserError(this, 124, PerformanceVector.class, getMaxSize() + "");
}
PerformanceVector[] allVectorsArray = new PerformanceVector[allVectors.size()];
allVectors.toArray(allVectorsArray);
// // create result array
// IOObject[] resultArray = new IOObject[allVectors.size() + 1];
// System.arraycopy(allVectorsArray, 0, resultArray, 0, allVectorsArray.length);
SignificanceTestResult result = performSignificanceTest(allVectorsArray, getParameterAsDouble(PARAMETER_ALPHA));
performanceExtender.passDataThrough();
significanceOutput.deliver(result);
}
示例4: performSignificanceTest
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的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());
}
}
示例5: performSignificanceTest
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
@Override
public SignificanceTestResult performSignificanceTest(PerformanceVector[] allVectors, double alpha) {
double[][] resultMatrix = new double[allVectors.length][allVectors.length];
for (int i = 0; i < allVectors.length; i++) {
for (int j = 0; j < i + 1; j++) {
resultMatrix[i][j] = Double.NaN; // fill lower triangle with
}
// NaN --> empty in result
// string
for (int j = i + 1; j < allVectors.length; j++) {
resultMatrix[i][j] = getProbability(allVectors[i].getMainCriterion(), allVectors[j].getMainCriterion());
}
}
return new TTestSignificanceTestResult(allVectors, resultMatrix, alpha);
}
示例6: GroupedANOVAOperator
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
public GroupedANOVAOperator(OperatorDescription desc) {
super(desc);
getTransformer().addRule(new GenerateNewMDRule(significanceOutput, SignificanceTestResult.class));
getTransformer().addPassThroughRule(exampleSetInput, exampleSetOutput);
exampleSetInput.addPrecondition(new AttributeSetPrecondition(exampleSetInput, AttributeSetPrecondition
.getAttributesByParameter(this, PARAMETER_ANOVA_ATTRIBUTE), Ontology.NUMERICAL));
exampleSetInput.addPrecondition(new AttributeSetPrecondition(exampleSetInput, AttributeSetPrecondition
.getAttributesByParameter(this, PARAMETER_GROUP_BY_ATTRIBUTE), Ontology.NOMINAL));
}
示例7: performSignificanceTest
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
@Override
public SignificanceTestResult performSignificanceTest(PerformanceVector[] allVectors, double alpha) {
double[][] resultMatrix = new double[allVectors.length][allVectors.length];
for (int i = 0; i < allVectors.length; i++) {
for (int j = 0; j < (i + 1); j++)
resultMatrix[i][j] = Double.NaN; // fill lower triangle with
// NaN --> empty in result
// string
for (int j = i + 1; j < allVectors.length; j++) {
resultMatrix[i][j] = getProbability(allVectors[i].getMainCriterion(), allVectors[j].getMainCriterion());
}
}
return new TTestSignificanceTestResult(allVectors, resultMatrix, alpha);
}
示例8: GroupedANOVAOperator
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
public GroupedANOVAOperator(OperatorDescription desc) {
super(desc);
getTransformer().addRule(new GenerateNewMDRule(significanceOutput, SignificanceTestResult.class));
getTransformer().addPassThroughRule(exampleSetInput, exampleSetOutput);
exampleSetInput.addPrecondition(new AttributeSetPrecondition(exampleSetInput, AttributeSetPrecondition.getAttributesByParameter(this, PARAMETER_ANOVA_ATTRIBUTE), Ontology.NUMERICAL));
exampleSetInput.addPrecondition(new AttributeSetPrecondition(exampleSetInput, AttributeSetPrecondition.getAttributesByParameter(this, PARAMETER_GROUP_BY_ATTRIBUTE), Ontology.NOMINAL));
}
示例9: calculateANOVA
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的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"));
}
}
示例10: SignificanceTestOperator
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
public SignificanceTestOperator(OperatorDescription description) {
super(description);
performanceExtender.start();
getTransformer().addRule(new GenerateNewMDRule(significanceOutput, SignificanceTestResult.class));
getTransformer().addRule(performanceExtender.makePassThroughRule());
}
示例11: doWork
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet inputSet = exampleSetInput.getData(ExampleSet.class);
ExampleSet exampleSet = new NonSpecialAttributesExampleSet(inputSet);
// determine anova and grouping attributes
List<String> nominalAttributes = new ArrayList<String>();
List<String> numericalAttributes = new ArrayList<String>();
Iterator<Attribute> a = exampleSet.getAttributes().allAttributes();
while (a.hasNext()) {
Attribute attribute = a.next();
if (attribute.isNominal()) {
nominalAttributes.add(attribute.getName());
} else if (attribute.isNumerical()) {
numericalAttributes.add(attribute.getName());
}
}
// init "inner" operator
GroupedANOVAOperator groupedAnovaOperator = null;
try {
groupedAnovaOperator = OperatorService.createOperator(GroupedANOVAOperator.class);
} catch (OperatorCreationException e) {
throw new UserError(this, 109, GroupedANOVAOperator.class.getName());
}
double significanceLevel = getParameterAsDouble(GroupedANOVAOperator.PARAMETER_SIGNIFICANCE_LEVEL);
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_SIGNIFICANCE_LEVEL, significanceLevel + "");
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_ONLY_DISTINCT,
getParameterAsBoolean(GroupedANOVAOperator.PARAMETER_ONLY_DISTINCT) + "");
// calculate all values
double[][] probabilities = new double[numericalAttributes.size()][nominalAttributes.size()];
for (int numericalCounter = 0; numericalCounter < probabilities.length; numericalCounter++) {
String numericalAttributeName = numericalAttributes.get(numericalCounter);
for (int nominalCounter = 0; nominalCounter < probabilities[numericalCounter].length; nominalCounter++) {
String nominalAttributeName = nominalAttributes.get(nominalCounter);
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_ANOVA_ATTRIBUTE, numericalAttributeName);
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_GROUP_BY_ATTRIBUTE, nominalAttributeName);
SignificanceTestResult testResult = groupedAnovaOperator.apply((ExampleSet) exampleSet.clone());
probabilities[numericalCounter][nominalCounter] = testResult.getProbability();
}
}
// create and return result
exampleSetOutput.deliver(exampleSet);
anovaOutput.deliver(new ANOVAMatrix(probabilities, numericalAttributes, nominalAttributes, significanceLevel));
}
示例12: apply
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的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;
}
示例13: doWork
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet inputSet = exampleSetInput.getData(ExampleSet.class);
ExampleSet exampleSet = new NonSpecialAttributesExampleSet(inputSet);
// determine anova and grouping attributes
List<String> nominalAttributes = new ArrayList<String>();
List<String> numericalAttributes = new ArrayList<String>();
Iterator<Attribute> a = exampleSet.getAttributes().allAttributes();
while (a.hasNext()) {
Attribute attribute = a.next();
if (attribute.isNominal())
nominalAttributes.add(attribute.getName());
else if (attribute.isNumerical())
numericalAttributes.add(attribute.getName());
}
// init "inner" operator
GroupedANOVAOperator groupedAnovaOperator = null;
try {
groupedAnovaOperator = OperatorService.createOperator(GroupedANOVAOperator.class);
} catch (OperatorCreationException e) {
throw new UserError(this, 109, GroupedANOVAOperator.class.getName());
}
double significanceLevel = getParameterAsDouble(GroupedANOVAOperator.PARAMETER_SIGNIFICANCE_LEVEL);
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_SIGNIFICANCE_LEVEL, significanceLevel + "");
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_ONLY_DISTINCT, getParameterAsBoolean(GroupedANOVAOperator.PARAMETER_ONLY_DISTINCT) + "");
// calculate all values
double[][] probabilities = new double[numericalAttributes.size()][nominalAttributes.size()];
for (int numericalCounter = 0; numericalCounter < probabilities.length; numericalCounter++) {
String numericalAttributeName = numericalAttributes.get(numericalCounter);
for (int nominalCounter = 0; nominalCounter < probabilities[numericalCounter].length; nominalCounter++) {
String nominalAttributeName = nominalAttributes.get(nominalCounter);
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_ANOVA_ATTRIBUTE, numericalAttributeName);
groupedAnovaOperator.setParameter(GroupedANOVAOperator.PARAMETER_GROUP_BY_ATTRIBUTE, nominalAttributeName);
SignificanceTestResult testResult = groupedAnovaOperator.apply((ExampleSet)exampleSet.clone());
probabilities[numericalCounter][nominalCounter] = testResult.getProbability();
}
}
// create and return result
exampleSetOutput.deliver(exampleSet);
anovaOutput.deliver(new ANOVAMatrix(probabilities, numericalAttributes, nominalAttributes, significanceLevel));
}
示例14: apply
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的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;
}
示例15: performSignificanceTest
import com.rapidminer.tools.math.SignificanceTestResult; //导入依赖的package包/类
/**
* Returns the result of the significance test for the given performance vector collection.
*/
public abstract SignificanceTestResult performSignificanceTest(PerformanceVector[] allVectors, double alpha)
throws OperatorException;