/** * {@inheritDoc} */ @Override public synchronized double[] getValues() { return super.getValues(); }
/** * Returns the current set of values in an array of double primitives, * sorted in ascending order. The returned array is a fresh * copy of the underlying data -- i.e., it is not a reference to the * stored data. * @return returns the current set of * numbers sorted in ascending order */ public double[] getSortedValues() { double[] sort = getValues(); Arrays.sort(sort); return sort; }
private static void saveDataFile(String location, String name, DescriptiveStatistics data, TimeUnit scale) { long conv = scale.toNanos(1); Path dst = Paths.get(location, name); try (PrintStream output = new PrintStream(dst.toString())) { // Print all values one per line Arrays.stream(data.getValues()).forEach(d -> output.println(d / conv)); } catch (FileNotFoundException e) { LOG.error("failed to write to {}", dst); } }
/** * Get median value for given statistics. * @param data collected datapoints. * @return median value. */ private static double median(@NotNull DescriptiveStatistics data) { return new Median().evaluate(data.getValues()); }
/** * Get new statistics that excludes values beyond mean +/- 2 * stdev * * @param data Source data * @return new {@link @DescriptiveStatistics objects with sanitized data} */ private static DescriptiveStatistics sanitize(@NotNull DescriptiveStatistics data) { double meanValue = data.getMean(); double delta = MARGIN * meanValue; double minVal = meanValue - delta; double maxVal = meanValue + delta; return new DescriptiveStatistics(Arrays.stream(data.getValues()) .filter(x -> x > minVal && x < maxVal) .toArray()); }
log.info("data: " + Arrays.toString(statistics.getValues())); log.info(statistics.toString()); String specifiedPartitions = Joiner.on(",").join(partitionPoints);
/** * {@inheritDoc} */ @Override public synchronized double[] getValues() { return super.getValues(); }
public double[] getValues() { return stats.getValues(); }
/** * Returns the current set of values in an array of double primitives, * sorted in ascending order. The returned array is a fresh * copy of the underlying data -- i.e., it is not a reference to the * stored data. * @return returns the current set of * numbers sorted in ascending order */ public double[] getSortedValues() { double[] sort = getValues(); Arrays.sort(sort); return sort; }
public void addIteration(final Result<Task> other) { if (!_task.equals(other._task)) throw new IllegalArgumentException(_task + " != " + other._task); for (final double mem : other.getMemory().getValues()) _memory.addValue(mem); for (final double t : other.getTime().getValues()) _time.addValue(t); }
@Override public long[] getValues() { return Arrays.stream(descriptiveStatistics.getValues()).mapToLong(i -> (long) i).toArray(); }
@Override public long[] getValues() { return Arrays.stream(descriptiveStatistics.getValues()).mapToLong(i -> (long) i).toArray(); }
@Override public long[] getValues() { return Arrays.stream(descriptiveStatistics.getValues()).mapToLong(i -> (long) i).toArray(); }
private void printResults() { if (this.measureTermsLength) { System.out.println("Average graph length is " + this.graphLength.getMean()); System.out.println("Average subject length is " + this.subjectLength.getMean()); System.out.println("Average predicate length is " + this.predicateLength.getMean()); System.out.println("Average object length is " + this.objectLength.getMean()); System.out.println(); } System.out.println(this.quadsLength.getValues().length + " quadruples measured"); System.out.println("Average quadruple length is " + this.quadsLength.getMean()); }
@Override public Object doWork(Object first, Object second) throws IOException{ if(null == first){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory))); } if(null == second){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the second value",toExpression(constructingFactory))); } if(!(first instanceof List<?>)){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the first value, expecting a List",toExpression(constructingFactory), first.getClass().getSimpleName())); } if(!(second instanceof Number)){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - found type %s for the second value, expecting a Number",toExpression(constructingFactory), first.getClass().getSimpleName())); } List<?> values = (List<?>)first; int window = ((Number)second).intValue(); List<Number> moving = new ArrayList<>(); DescriptiveStatistics slider = new DescriptiveStatistics(window); Percentile percentile = new Percentile(); for(Object value : values){ slider.addValue(((Number)value).doubleValue()); if(slider.getN() >= window){ double median = percentile.evaluate(slider.getValues(), 50); moving.add(median); } } return moving; }
public void normaliseToMinimum(double normalMin) { final double min = stats.samples.getMin(); final double[] values = stats.samples.getValues(); stats.samples.clear(); final double diff = normalMin - min; for (double v : values) { stats.samples.addValue(v + diff); } }
private void writeResults() throws IOException { writeMessageToFile( "Experiment Finished Sucessfully. Data " + max_processes + ", " + stable_time_period + ", " + stats.getMin() + ", " + stats.getMax() + ", " + stats.getMean() + ", " + stats.getVariance() + ", " + stats.getStandardDeviation() + ", " + (stats.getStandardDeviation() / Math.sqrt(stats.getN()))); writeMessageToFile("DataPoints: " + stable_time_period + " " + Arrays.toString(stats.getValues())); }
result += "\nOverall Recall:\n" + bestReturnedSolutionRecallStats; result += "\nOverall FMeasure:\n" + bestReturnedSolutionFMeasureStats; result += "\nPositions of best solution:\n" + Arrays.toString(bestSolutionPositionStats.getValues()); result += "\nPosition of best solution stats:\n" + bestSolutionPositionStats;
result += "\nPositions of best solution:\n" + Arrays.toString(bestSolutionPositionStats.getValues()); result += "\nPosition of best solution stats:\n" + bestSolutionPositionStats; result += "\nOverall Precision of best solution:\n" + bestSolutionPrecisionStats;
result += "\nPositions of best solution:\n" + Arrays.toString(bestSolutionPositionStats.getValues()); result += "\nPosition of best solution stats:\n" + bestSolutionPositionStats; result += "\nOverall Precision of best solution:\n" + bestSolutionPrecisionStats;