/** * {@inheritDoc}. This version returns a sum of all the aggregated data. * * @see StatisticalSummary#getSum() */ public double getSum() { synchronized (statistics) { return statistics.getSum(); } }
/** * Generates a text report displaying summary statistics from values that * have been added. * @return String with line feeds displaying statistics * @since 1.2 */ @Override public String toString() { StringBuilder outBuffer = new StringBuilder(); String endl = "\n"; outBuffer.append("SummaryStatistics:").append(endl); outBuffer.append("n: ").append(getN()).append(endl); outBuffer.append("min: ").append(getMin()).append(endl); outBuffer.append("max: ").append(getMax()).append(endl); outBuffer.append("sum: ").append(getSum()).append(endl); outBuffer.append("mean: ").append(getMean()).append(endl); outBuffer.append("geometric mean: ").append(getGeometricMean()) .append(endl); outBuffer.append("variance: ").append(getVariance()).append(endl); outBuffer.append("population variance: ").append(getPopulationVariance()).append(endl); outBuffer.append("second moment: ").append(getSecondMoment()).append(endl); outBuffer.append("sum of squares: ").append(getSumsq()).append(endl); outBuffer.append("standard deviation: ").append(getStandardDeviation()) .append(endl); outBuffer.append("sum of logs: ").append(getSumOfLogs()).append(endl); return outBuffer.toString(); }
final double sum = data.getSum(); final double sumsq = data.getSumsq(); final int num = (int) data.getN();
/** * {@inheritDoc} */ @Override public synchronized double getSum() { return super.getSum(); }
/** * Returns true iff <code>object</code> is a * <code>SummaryStatistics</code> instance and all statistics have the * same values as this. * @param object the object to test equality against. * @return true if object equals this */ @Override public boolean equals(Object object) { if (object == this) { return true; } if (object instanceof SummaryStatistics == false) { return false; } SummaryStatistics stat = (SummaryStatistics)object; return Precision.equalsIncludingNaN(stat.getGeometricMean(), getGeometricMean()) && Precision.equalsIncludingNaN(stat.getMax(), getMax()) && Precision.equalsIncludingNaN(stat.getMean(), getMean()) && Precision.equalsIncludingNaN(stat.getMin(), getMin()) && Precision.equalsIncludingNaN(stat.getN(), getN()) && Precision.equalsIncludingNaN(stat.getSum(), getSum()) && Precision.equalsIncludingNaN(stat.getSumsq(), getSumsq()) && Precision.equalsIncludingNaN(stat.getVariance(), getVariance()); }
private static Stats getStats(NumericColumn<?> values, SummaryStatistics summaryStatistics) { Stats stats = new Stats("Column: " + values.name()); stats.min = summaryStatistics.getMin(); stats.max = summaryStatistics.getMax(); stats.n = summaryStatistics.getN(); stats.sum = summaryStatistics.getSum(); stats.variance = summaryStatistics.getVariance(); stats.populationVariance = summaryStatistics.getPopulationVariance(); stats.quadraticMean = summaryStatistics.getQuadraticMean(); stats.geometricMean = summaryStatistics.getGeometricMean(); stats.mean = summaryStatistics.getMean(); stats.standardDeviation = summaryStatistics.getStandardDeviation(); stats.sumOfLogs = summaryStatistics.getSumOfLogs(); stats.sumOfSquares = summaryStatistics.getSumsq(); stats.secondMoment = summaryStatistics.getSecondMoment(); return stats; }
/** * Return a {@link StatisticalSummaryValues} instance reporting current * statistics. * @return Current values of statistics */ public StatisticalSummary getSummary() { return new StatisticalSummaryValues(getMean(), getVariance(), getN(), getMax(), getMin(), getSum()); }
/** * Returns hash code based on values of statistics * @return hash code */ @Override public int hashCode() { int result = 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getMax()); result = result * 31 + MathUtils.hash(getMean()); result = result * 31 + MathUtils.hash(getMin()); result = result * 31 + MathUtils.hash(getN()); result = result * 31 + MathUtils.hash(getSum()); result = result * 31 + MathUtils.hash(getSumsq()); result = result * 31 + MathUtils.hash(getVariance()); return result; }
double avg = ss.getSum()/ss.getN(), stdev = ss.getStandardDeviation(), cv = stdev/avg; double allowedMin = avg - 2.5 * stdev, allowedMax = avg + 2.5 * stdev; if (allowedMin > ss.getMin() || allowedMax < ss.getMax() || cv > 0.22) {
/** * Returns hash code based on values of statistics * @return hash code */ @Override public int hashCode() { int result = 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getGeometricMean()); result = result * 31 + MathUtils.hash(getMax()); result = result * 31 + MathUtils.hash(getMean()); result = result * 31 + MathUtils.hash(getMin()); result = result * 31 + MathUtils.hash(getN()); result = result * 31 + MathUtils.hash(getSum()); result = result * 31 + MathUtils.hash(getSumsq()); result = result * 31 + MathUtils.hash(getVariance()); return result; }
SummaryStatistics summStats = tokenStatistics.getSummaryStatistics(); data.put(Cols.TOKEN_LENGTH_SUM, Integer.toString((int) summStats.getSum()));
StringUtils.getStackTrace(Thread.currentThread()), logAction.getCount() - 1, logAction.getStats(0).getMax(), logAction.getStats(0).getSum() - writeLockIntervalMs);
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TokenStatistics that = (TokenStatistics) o; if (totalTokens != that.totalTokens) return false; if (totalUniqueTokens != that.totalUniqueTokens) return false; if (!doubleEquals(that.entropy, entropy)) return false; // Probably incorrect - comparing Object[] arrays with Arrays.equals if (!Arrays.equals(topN, that.topN)) return false; SummaryStatistics thatS = ((TokenStatistics) o).summaryStatistics; if (summaryStatistics.getN() != thatS.getN()) return false; //if both have n==0, don't bother with the stats if (summaryStatistics.getN() ==0L) return true; //TODO: consider adding others... if (!doubleEquals(summaryStatistics.getGeometricMean(), thatS.getGeometricMean())) return false; if (!doubleEquals(summaryStatistics.getMax(), thatS.getMax())) return false; if (!doubleEquals(summaryStatistics.getMean(), thatS.getMean())) return false; if (!doubleEquals(summaryStatistics.getMin(), thatS.getMin())) return false; if (!doubleEquals(summaryStatistics.getSum(), thatS.getSum())) return false; if (!doubleEquals(summaryStatistics.getStandardDeviation(), thatS.getStandardDeviation())) return false; return true; }
/** * {@inheritDoc} */ @Override public synchronized double getSum() { return super.getSum(); }
/** * {@inheritDoc}. This version returns a sum of all the aggregated data. * * @see StatisticalSummary#getSum() */ public double getSum() { synchronized (statistics) { return statistics.getSum(); } }
/** * {@inheritDoc}. This version returns a sum of all the aggregated data. * * @see StatisticalSummary#getSum() */ public double getSum() { synchronized (statistics) { return statistics.getSum(); } }
/** * {@inheritDoc} */ @Override public synchronized double getSum() { return super.getSum(); }
@Test public void youCanGetTheRegressionCoefficients() { double s_xy = xyStats.getSum() - (xStats.getSum() * yStats.getSum() / xStats.getN()); double s_xx = xStats.getSecondMoment(); double expectedGradient = s_xy / s_xx; assertThat(stats.estimatedGradient(), equalTo(expectedGradient)); double expectedIntercept = yStats.getMean() - expectedGradient * xStats.getMean(); assertThat(stats.estimatedIntercept(), equalTo(expectedIntercept)); }
/** * Return a {@link StatisticalSummaryValues} instance reporting current * statistics. * @return Current values of statistics */ public StatisticalSummary getSummary() { return new StatisticalSummaryValues(getMean(), getVariance(), getN(), getMax(), getMin(), getSum()); }
/** * Return a {@link StatisticalSummaryValues} instance reporting current * statistics. * @return Current values of statistics */ public StatisticalSummary getSummary() { return new StatisticalSummaryValues(getMean(), getVariance(), getN(), getMax(), getMin(), getSum()); }