org.apache.commons.math3.stat.descriptive.AggregateSummaryStatistics Java Examples

The following examples show how to use org.apache.commons.math3.stat.descriptive.AggregateSummaryStatistics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AggregateStats.java    From Java-Data-Science-Cookbook with MIT License 7 votes vote down vote up
public void getAggregateStats(double[] values1, double[] values2){
	AggregateSummaryStatistics aggregate = new AggregateSummaryStatistics();
	SummaryStatistics firstSet = aggregate.createContributingStatistics();
	SummaryStatistics secondSet = aggregate.createContributingStatistics();
	
	for(int i = 0; i < values1.length; i++) {
		firstSet.addValue(values1[i]);
	}
	for(int i = 0; i < values2.length; i++) {
		secondSet.addValue(values2[i]);
	}
	
	double sampleSum = aggregate.getSum();
	double sampleMean = aggregate.getMean();
	double sampleStd= aggregate.getStandardDeviation();
	System.out.println(sampleSum + "\t" + sampleMean + "\t" + sampleStd);
}
 
Example #2
Source File: TabletSummary.java    From timely with Apache License 2.0 5 votes vote down vote up
public Map<TabletStatisticType, StatisticalSummary> aggregateSummary() {
    // @formatter:off
    return tabletStats.stream()
            .flatMap(m -> m.getSummaryMap().entrySet().stream())
            .collect(Collectors.groupingBy(Map.Entry::getKey,
                    Collectors.mapping(Map.Entry::getValue, Collectors.toList())))
            .entrySet().stream()
            .collect(Collectors.toMap(Map.Entry::getKey, v -> AggregateSummaryStatistics.aggregate(v.getValue())));
}
 
Example #3
Source File: AbstractOwlSim.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void computeSystemStats() throws UnknownOWLClassException {
	Set<OWLNamedIndividual> insts = this.getAllElements();
	LOG.info("Computing system stats for " + insts.size() + " individuals");
	LOG.info("Creating singular stat scores for all IDspaces");

	Collection<SummaryStatistics> aggregate = new ArrayList<SummaryStatistics>();

	this.overallStats = new SummaryStatistics();

	int counter = 0;
	for (OWLNamedIndividual i : insts) {			
		counter++;
		SummaryStatistics statsPerIndividual = computeIndividualStats(i);			
		//put this individual into the aggregate
		if (statsPerIndividual.getN() == 0) {
			LOG.error("No annotations found for Individual "+i.toStringID());
		} else {
			aggregate.add(statsPerIndividual);
		}
		//TODO: put this individual into an idSpace aggregate
		//			String idSpace = i.getIRI().getNamespace();
		this.overallStats.addValue(statsPerIndividual.getMean());
		if (counter % 1000 == 0) {
			LOG.info("Finished "+counter+" individuals");
		}
	}
	//		this.aggregateStatsPerIndividual = AggregateSummaryStatistics.aggregate(aggregate);	
	StatsPerIndividual myStats = new StatsPerIndividual();

	myStats.mean = getSummaryStatisticsForCollection(aggregate,Stat.MEAN);
	myStats.sum  = getSummaryStatisticsForCollection(aggregate,Stat.SUM);
	myStats.min  = getSummaryStatisticsForCollection(aggregate,Stat.MIN);
	myStats.max  = getSummaryStatisticsForCollection(aggregate,Stat.MAX);
	myStats.n  = getSummaryStatisticsForCollection(aggregate,Stat.N);		
	myStats.aggregate = AggregateSummaryStatistics.aggregate(aggregate);
	this.overallSummaryStatsPerIndividual = myStats;
	LOG.info("Finished computing overall statsPerIndividual:\n"+this.getSummaryStatistics().toString());
}