本文整理汇总了Java中com.rapidminer.tools.math.function.aggregation.AggregationFunction类的典型用法代码示例。如果您正苦于以下问题:Java AggregationFunction类的具体用法?Java AggregationFunction怎么用?Java AggregationFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AggregationFunction类属于com.rapidminer.tools.math.function.aggregation包,在下文中一共展示了AggregationFunction类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerAllCombinationsRecursion
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
/**
* The recursively called method.
*
* @throws UserError
*/
private void registerAllCombinationsRecursion(Attribute[] groupByAttributes,
MultidimensionalArraySet<AggregationFunction[]> functionSet, boolean ignoreMissings,
AggregationAttribute[] aggregationAttributes, int[] indices, int depth) throws UserError {
if (depth == indices.length) {
AggregationFunction[] functions = new AggregationFunction[aggregationAttributes.length];
for (int j = 0; j < aggregationAttributes.length; j++) {
functions[j] = getAggregationFunction(aggregationAttributes[j].functionName, ignoreMissings,
aggregationAttributes[j].attribute);
}
functionSet.set(indices, functions);
} else {
NominalMapping mapping = groupByAttributes[depth].getMapping();
for (String value : mapping.getValues()) {
indices[depth] = mapping.getIndex(value);
registerAllCombinationsRecursion(groupByAttributes, functionSet, ignoreMissings, aggregationAttributes,
indices, depth + 1);
}
}
}
示例2: getAggregatedValueForGroupCell
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
public double getAggregatedValueForGroupCell(SeriesUsageType seriesUsage, GroupCellKey groups) {
DataTable data = getDataTableForGroupCell(groups);
if (data == null) {
return Double.NaN;
}
double[] doubleArray = new double[data.getRowNumber()];
int i = 0;
int columnIdx = getDataTableColumnIdx(seriesUsage);
for (DataTableRow d : data) {
doubleArray[i] = d.getValue(columnIdx);
++i;
}
AggregationFunction aggregationFunction = valueSource.getAggregationFunction(seriesUsage);
double calculate = aggregationFunction.calculate(doubleArray);
if (Double.isInfinite(calculate)) {
calculate = Double.NaN;
}
return calculate;
}
示例3: registerAllCombinationsRecursion
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
/**
* The recursively called method.
*
* @throws UserError
*/
private void registerAllCombinationsRecursion(Attribute[] groupByAttributes, MultidimensionalArraySet<AggregationFunction[]> functionSet, boolean ignoreMissings, AggregationAttribute[] aggregationAttributes, int[] indices, int depth) throws UserError {
if (depth == indices.length) {
AggregationFunction[] functions = new AggregationFunction[aggregationAttributes.length];
for (int j = 0; j < aggregationAttributes.length; j++) {
functions[j] = getAggregationFunction(aggregationAttributes[j].functionName, ignoreMissings, aggregationAttributes[j].attribute);
}
functionSet.set(indices, functions);
} else {
NominalMapping mapping = groupByAttributes[depth].getMapping();
for (String value : mapping.getValues()) {
indices[depth] = mapping.getIndex(value);
registerAllCombinationsRecursion(groupByAttributes, functionSet, ignoreMissings, aggregationAttributes, indices, depth + 1);
}
}
}
示例4: registerAllCombinations
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
/**
* This method will register for each index of the group by attributes' mapping the
* corresponding aggregation functions
*
* @throws UserError
*/
private void registerAllCombinations(Attribute[] groupByAttributes,
MultidimensionalArraySet<AggregationFunction[]> functionSet, boolean ignoreMissings,
AggregationAttribute[] aggregationAttributes) throws UserError {
registerAllCombinationsRecursion(groupByAttributes, functionSet, ignoreMissings, aggregationAttributes,
new int[groupByAttributes.length], 0);
}
示例5: getAggregationFunctionType
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
public AggregationFunctionType getAggregationFunctionType(SeriesUsageType usageType) {
AggregationFunction aggregationFunction = aggregationFunctionMap.get(usageType);
if (aggregationFunction != null) {
return AggregationFunctionType.valueOf(aggregationFunction.getName());
} else {
return null;
}
}
示例6: doesAggregationFunctionSupportValueType
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
public boolean doesAggregationFunctionSupportValueType(AggregationFunction function, ValueType valueType) {
switch (valueType) {
case DATE_TIME:
return function.supportsValueType(Ontology.DATE_TIME);
case NOMINAL:
return function.supportsValueType(Ontology.NOMINAL);
case NUMERICAL:
return function.supportsValueType(Ontology.NUMERICAL);
case INVALID:
case UNKNOWN:
return false;
default:
return false;
}
}
示例7: apply
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的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;
}
示例8: getAggregationFunction
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
public AggregationFunction getAggregationFunction(SeriesUsageType usageType) {
return aggregationFunctionMap.get(usageType);
}
示例9: fireAggregationFunctionChanged
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
private void fireAggregationFunctionChanged(AggregationFunction function, SeriesUsageType seriesUsage) {
if (function != null) {
fireValueSourceChanged(new ValueSourceChangeEvent(this, AggregationFunctionType.valueOf(function.getName()),
seriesUsage));
}
}
示例10: apply
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的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;
}
示例11: fireAggregationFunctionChanged
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
private void fireAggregationFunctionChanged(AggregationFunction function, SeriesUsageType seriesUsage) {
if (function != null) {
fireValueSourceChanged(new ValueSourceChangeEvent(this, AggregationFunctionType.valueOf(function.getName()), seriesUsage));
}
}
示例12: registerAllCombinations
import com.rapidminer.tools.math.function.aggregation.AggregationFunction; //导入依赖的package包/类
/**
* This method will register for each index of the group by attributes' mapping the corresponding aggregation functions
*
* @throws UserError
*/
private void registerAllCombinations(Attribute[] groupByAttributes, MultidimensionalArraySet<AggregationFunction[]> functionSet, boolean ignoreMissings, AggregationAttribute[] aggregationAttributes) throws UserError {
registerAllCombinationsRecursion(groupByAttributes, functionSet, ignoreMissings, aggregationAttributes, new int[groupByAttributes.length], 0);
}