LoggingAction(int valueCount) { stats = new SummaryStatistics[valueCount]; for (int i = 0; i < stats.length; i++) { stats[i] = new SummaryStatistics(); } }
/** * Initializes a new AggregateSummaryStatistics with default statistics * implementations. * */ public AggregateSummaryStatistics() { // No try-catch or throws NAE because arg is guaranteed non-null this(new SummaryStatistics()); }
/** * Initializes a new AggregateSummaryStatistics with the specified statistics * object as a prototype for contributing statistics and for the internal * aggregate statistics. This provides for customized statistics implementations * to be used by contributing and aggregate statistics. * * @param prototypeStatistics a {@code SummaryStatistics} serving as a * prototype both for the internal aggregate statistics and for * contributing statistics obtained via the * {@code createContributingStatistics()} method. Being a prototype * means that other objects are initialized by copying this object's state. * If {@code null}, a new, default statistics object is used. Any statistic * values in the prototype are propagated to contributing statistics * objects and (once) into these aggregate statistics. * @throws NullArgumentException if prototypeStatistics is null * @see #createContributingStatistics() */ public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics) throws NullArgumentException { this(prototypeStatistics, prototypeStatistics == null ? null : new SummaryStatistics(prototypeStatistics)); }
/** * Initializes a new AggregateSummaryStatistics with the specified statistics * object as a prototype for contributing statistics and for the internal * aggregate statistics. This provides for different statistics implementations * to be used by contributing and aggregate statistics and for an initial * state to be supplied for the aggregate statistics. * * @param prototypeStatistics a {@code SummaryStatistics} serving as a * prototype both for the internal aggregate statistics and for * contributing statistics obtained via the * {@code createContributingStatistics()} method. Being a prototype * means that other objects are initialized by copying this object's state. * If {@code null}, a new, default statistics object is used. Any statistic * values in the prototype are propagated to contributing statistics * objects, but not into these aggregate statistics. * @param initialStatistics a {@code SummaryStatistics} to serve as the * internal aggregate statistics object. If {@code null}, a new, default * statistics object is used. * @see #createContributingStatistics() */ public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics, SummaryStatistics initialStatistics) { this.statisticsPrototype = (prototypeStatistics == null) ? new SummaryStatistics() : prototypeStatistics; this.statistics = (initialStatistics == null) ? new SummaryStatistics() : initialStatistics; }
/** * Returns a copy of this SummaryStatistics instance with the same internal state. * * @return a copy of this */ public SummaryStatistics copy() { SummaryStatistics result = new SummaryStatistics(); // No try-catch or advertised exception because arguments are guaranteed non-null copy(this, result); return result; }
/** {@inheritDoc} */ @Override public void computeStats() throws IOException { sampleStats = new SummaryStatistics(); for (int i = 0; i < inputArray.length; i++) { sampleStats.addValue(inputArray[i]); } }
/** {@inheritDoc} */ @Override public void computeStats() throws IOException { String str = null; double val = 0.0; sampleStats = new SummaryStatistics(); while ((str = inputStream.readLine()) != null) { val = Double.parseDouble(str); sampleStats.addValue(val); } inputStream.close(); inputStream = null; } }
/** * This method calls the method that actually does the calculations (except * P-value). * * @param categoryData * <code>Collection</code> of <code>double[]</code> arrays each * containing data for one category * @return computed AnovaStats * @throws NullArgumentException * if <code>categoryData</code> is <code>null</code> * @throws DimensionMismatchException * if the length of the <code>categoryData</code> array is less * than 2 or a contained <code>double[]</code> array does not * contain at least two values */ private AnovaStats anovaStats(final Collection<double[]> categoryData) throws NullArgumentException, DimensionMismatchException { MathUtils.checkNotNull(categoryData); final Collection<SummaryStatistics> categoryDataSummaryStatistics = new ArrayList<SummaryStatistics>(categoryData.size()); // convert arrays to SummaryStatistics for (final double[] data : categoryData) { final SummaryStatistics dataSummaryStatistics = new SummaryStatistics(); categoryDataSummaryStatistics.add(dataSummaryStatistics); for (final double val : data) { dataSummaryStatistics.addValue(val); } } return anovaStats(categoryDataSummaryStatistics, false); }
public static Stats create(final NumericColumn<?> values) { SummaryStatistics summaryStatistics = new SummaryStatistics(); for (int i = 0; i < values.size(); i++) { summaryStatistics.addValue(values.getDouble(i)); } return getStats(values, summaryStatistics); }
private static SummaryStatistics[] getStats(final ArrayOfDoublesSketch sketch) { final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } return stats; }
SummaryStatistics stats = new SummaryStatistics(); binStats.add(i,stats);
++hitCounts[index]; SummaryStatistics ss = new SummaryStatistics(); for (int hitCount : hitCounts) { ss.addValue(hitCount);
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] variances = new double[sketch.getNumValues()]; Arrays.setAll(variances, i -> stats[i].getVariance()); return variances; }
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] means = new double[sketch.getNumValues()]; Arrays.setAll(means, i -> stats[i].getMean()); return means; }
public Session(Account account, final Conditions conditions) { stats = new SummaryStatistics(); profitCurve = new ArrayList<BigDecimal>(); trades = new ArrayList<Trade>(); this.account = account; this.conditions = conditions; }
SummaryStatistics summaryStatistics = new SummaryStatistics(); for (Map.Entry<String, MutableInt> e : tokenMap.entrySet()) { String token = e.getKey();
/** {@inheritDoc} */ @Override public void computeStats() throws IOException { sampleStats = new SummaryStatistics(); for (int i = 0; i < inputArray.length; i++) { sampleStats.addValue(inputArray[i]); } }
SummaryStatistics summStats = new SummaryStatistics(); double ent = 0.0d; double p = 0.0d;
public static Stats create(final NumericColumn<?> values) { SummaryStatistics summaryStatistics = new SummaryStatistics(); for (int i = 0; i < values.size(); i++) { summaryStatistics.addValue(values.getDouble(i)); } return getStats(values, summaryStatistics); }
@Test public void samplingProducesRealisticMean() { SummaryStatistics stats = new SummaryStatistics(); samples.forEach(stats::addValue); Double expectedMean = ((double) lowerBound + (double) upperBound - 1) / 2.0; double mean = stats.getMean(); assertEquals(mean, expectedMean, epsilon); }