Example usage for org.apache.commons.math3.stat.descriptive AggregateSummaryStatistics aggregate

List of usage examples for org.apache.commons.math3.stat.descriptive AggregateSummaryStatistics aggregate

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive AggregateSummaryStatistics aggregate.

Prototype

public static StatisticalSummaryValues aggregate(Collection<SummaryStatistics> statistics) 

Source Link

Document

Computes aggregate summary statistics.

Usage

From source file:com.isentropy.accumulo.collections.MapAggregates.java

/**
 * Returns a statistical summary of all the map values that are instances of Number. It collects SummaryStatistics
 * for each tablet and aggregates the end results.
 * @param map//from   w w  w  .j a v a2  s  .co  m
 * @return
 */
public static StatisticalSummary valueStats(AccumuloSortedMap map, boolean includeMultipleValues) {
    AccumuloSortedMap tabletSummaries = map.deriveMap(new StatsDerivedMapper(), includeMultipleValues);
    List<SummaryStatistics> perTabletStats = new ArrayList<SummaryStatistics>();
    Set<Map.Entry> s = tabletSummaries.entrySet();
    for (Map.Entry e : s) {
        SummaryStatistics stats = (SummaryStatistics) e.getValue();
        perTabletStats.add(stats);
    }
    StatisticalSummaryValues fullstats = AggregateSummaryStatistics.aggregate(perTabletStats);
    return fullstats;
}

From source file:de.upb.wdqa.wdvd.processors.decorators.JsonProcessorReducer.java

@Override
public void reduce(List<RevisionProcessor> workerProcessors) {
    List<SummaryStatistics> emptyStatisticsList = new ArrayList<SummaryStatistics>();
    List<SummaryStatistics> inconsistentStatisticsList = new ArrayList<SummaryStatistics>();
    List<SummaryStatistics> jsonExceptionStatisticsList = new ArrayList<SummaryStatistics>();
    List<SummaryStatistics> nullPointerExceptionStatisticsList = new ArrayList<SummaryStatistics>();

    List<SummaryStatistics> newJsonStatisticsList = new ArrayList<SummaryStatistics>();
    List<SummaryStatistics> oldJsonStatisticsList = new ArrayList<SummaryStatistics>();
    List<SummaryStatistics> redirectStatisticsList = new ArrayList<SummaryStatistics>();

    for (RevisionProcessor processor : workerProcessors) {
        JsonProcessor jsonProcessor = (JsonProcessor) processor;

        emptyStatisticsList.add(jsonProcessor.getEmptyJsonStatistics());
        inconsistentStatisticsList.add(jsonProcessor.getInconsistentJsonXMLStatistics());
        jsonExceptionStatisticsList.add(jsonProcessor.getJsonExceptionStatistics());
        nullPointerExceptionStatisticsList.add(jsonProcessor.getNullPointerExceptionStatistics());

        newJsonStatisticsList.add(jsonProcessor.getNewJsonStatistics());
        oldJsonStatisticsList.add(jsonProcessor.getOldJsonStatistics());
        redirectStatisticsList.add(jsonProcessor.getRedirectStatistics());

    }// w  ww .  j a va2s  .  c  om

    StatisticalSummaryValues emptyStatistics = AggregateSummaryStatistics.aggregate(emptyStatisticsList);
    StatisticalSummaryValues inconsistentStatistics = AggregateSummaryStatistics
            .aggregate(inconsistentStatisticsList);
    StatisticalSummaryValues jsonExceptionStatistics = AggregateSummaryStatistics
            .aggregate(jsonExceptionStatisticsList);
    StatisticalSummaryValues nullPointerExceptionStatistics = AggregateSummaryStatistics
            .aggregate(nullPointerExceptionStatisticsList);

    StatisticalSummaryValues newJsonStatistics = AggregateSummaryStatistics.aggregate(newJsonStatisticsList);
    StatisticalSummaryValues oldJsonStatistics = AggregateSummaryStatistics.aggregate(oldJsonStatisticsList);
    StatisticalSummaryValues redirectStatistics = AggregateSummaryStatistics.aggregate(redirectStatisticsList);

    logger.info("Number of revisions with empty 'text' element: " + emptyStatistics.getN());
    logger.info("Number of revisions with inconsistent JSON/XML item id: " + inconsistentStatistics.getN());
    logger.info(
            "Number of revisions whose 'text' element could not be parsed: " + jsonExceptionStatistics.getN());
    logger.info(
            "Number of revisions which threw a NullPointerException: " + nullPointerExceptionStatistics.getN());
    long totalNumberOfFailures = emptyStatistics.getN() + inconsistentStatistics.getN()
            + jsonExceptionStatistics.getN() + nullPointerExceptionStatistics.getN();
    logger.info("Total number of revisions whose item document was discarded: " + totalNumberOfFailures);

    logger.info("Number of revisions in new JSON format: " + newJsonStatistics.getN());
    logger.info("Number of revisions in old JSON format: " + oldJsonStatistics.getN());
    logger.info("Number of revisions which represent a redirect: " + redirectStatistics.getN());
    long totalNumberOfSuccesses = newJsonStatistics.getN() + oldJsonStatistics.getN()
            + redirectStatistics.getN();
    logger.info(
            "Total number of revisions whose item document was successfully parsed: " + totalNumberOfSuccesses);

}