/** Constructs a VectorialMean. * @param dimension vectors dimension */ public VectorialMean(int dimension) { means = new Mean[dimension]; for (int i = 0; i < dimension; ++i) { means[i] = new Mean(); } }
/** Constructs a VectorialMean. * @param dimension vectors dimension */ public VectorialMean(int dimension) { means = new Mean[dimension]; for (int i = 0; i < dimension; ++i) { means[i] = new Mean(); } }
/** Constructs a VectorialMean. * @param dimension vectors dimension */ public VectorialMean(int dimension) { means = new Mean[dimension]; for (int i = 0; i < dimension; ++i) { means[i] = new Mean(); } }
/** * {@inheritDoc} */ @Override public Mean copy() { Mean result = new Mean(); copy(this, result); return result; }
/** * {@inheritDoc} */ @Override public Mean copy() { Mean result = new Mean(); copy(this, result); return result; }
@Override public double detect(double[] vec) { return new Mean().evaluate(vec); }
@Override public double detect(double[] vec) { return new Mean().evaluate(vec); }
/** * Calculates the mean of all attribute values. * * @param attributeValues attribute values * @return the mean */ public Double calculateMean( Comparable[] attributeValues ) { Mean mean = new Mean(); Double evaluatedMean = mean.evaluate( convertToPrimitives( attributeValues ) ); log.debug( "mean = " + evaluatedMean ); return evaluatedMean; }
/** * Calculates the centroid of all given points in a nD space (assumes that * all points have n coordinates). Each coordinate of the centroid is a mean * of all values of the same coordinate of each point. * * @param points all points * @return the centroid of all given points */ public Vector<Double> calculateCentroid( List<Vector<Double>> points ) { List<Mean> coordinateMeans = new ArrayList<Mean>(); for ( int i = 0; i < points.get( 0 ).size(); ++i ) { coordinateMeans.add( new Mean() ); } for ( Vector<Double> point : points ) { for ( int i = 0; i < point.size(); ++i ) { coordinateMeans.get( i ).increment( point.get( i ) ); } } Vector<Double> centroid = new Vector<Double>(); for ( Mean mean : coordinateMeans ) { centroid.add( mean.getResult() ); } return centroid; }
/** * This method calculates {@link SemiVariance} for the entire array against the mean, using * the current value of the biasCorrection instance property. * * @param values the input array * @param direction the {@link Direction} of the semivariance * @return the SemiVariance * @throws IllegalArgumentException if values is null * */ public double evaluate(final double[] values, Direction direction) { double m = (new Mean()).evaluate(values); return evaluate (values, m, direction, biasCorrected, 0, values.length); }
/** * Returns the mean of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the mean */ public double getMean() { if (mean == meanImpl) { return new Mean(secondMoment).getResult(); } else { return meanImpl.getResult(); } }
/** * Returns the mean of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the mean */ public double getMean() { if (mean == meanImpl) { return new Mean(secondMoment).getResult(); } else { return meanImpl.getResult(); } }
/** * Returns the mean of the values that have been added. * <p> * Double.NaN is returned if no values have been added.</p> * * @return the mean */ public double getMean() { if (mean == meanImpl) { return new Mean(secondMoment).getResult(); } else { return meanImpl.getResult(); } }
/** * This method calculates {@link SemiVariance} for the entire array against the mean, using * the current value of the biasCorrection instance property. * * @param values the input array * @param direction the {@link Direction} of the semivariance * @return the SemiVariance * @throws IllegalArgumentException if values is null * */ public double evaluate(final double[] values, Direction direction) { double m = (new Mean()).evaluate(values); return evaluate (values, m, direction, biasCorrected, 0, values.length); }
/** * <p>Returns the {@link SemiVariance} of the designated values against the mean, using * instance properties varianceDirection and biasCorrection.</p> * * <p>Returns <code>NaN</code> if the array is empty and throws * <code>IllegalArgumentException</code> if the array is null.</p> * * @param values the input array * @param start index of the first array element to include * @param length the number of elements to include * @return the SemiVariance * @throws IllegalArgumentException if the parameters are not valid * */ @Override public double evaluate(final double[] values, final int start, final int length) { double m = (new Mean()).evaluate(values, start, length); return evaluate(values, m, varianceDirection, biasCorrected, 0, values.length); }
/** * <p>Returns the {@link SemiVariance} of the designated values against the mean, using * instance properties varianceDirection and biasCorrection.</p> * * <p>Returns <code>NaN</code> if the array is empty and throws * <code>IllegalArgumentException</code> if the array is null.</p> * * @param values the input array * @param start index of the first array element to include * @param length the number of elements to include * @return the SemiVariance * @throws IllegalArgumentException if the parameters are not valid * */ @Override public double evaluate(final double[] values, final int start, final int length) { double m = (new Mean()).evaluate(values, start, length); return evaluate(values, m, varianceDirection, biasCorrected, 0, values.length); }
public double getValueRepresenting(TimeRange range) { Mean mean = new Mean(); for (DataPoint pt : getPoints(range)) { mean.increment(pt.getValue()); } return mean.getResult(); }
/** * @return Dom string average size (byte). */ public int getMeanStateStringSize() { final Mean mean = new Mean(); for (StateVertex state : getAllStates()) { mean.increment(state.getDomSize()); } return (int) mean.getResult(); }
/** * Returns the arithmetic mean of the result set. avg() is an alias for this * method. * * @param meter * the meter of the mean * @return the mean value. */ public final double mean(final AbstractMeter meter) { checkIfMeterExists(meter); final AbstractUnivariateStatistic mean = new Mean(); final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection(this.meterResults.get(meter)); return mean.evaluate(doubleColl.toArray(), 0, doubleColl.toArray().length); }
protected void compute() { Percentile percentile = new Percentile(); double[] rawDataAsArray = clearRawDataAndGetAsArray(); if (null != rawDataAsArray && rawDataAsArray.length != 0) { sampleSize = rawDataAsArray.length; percentile.setData(rawDataAsArray); percentile_99_5 = percentile.evaluate(99.5); percentile_99 = percentile.evaluate(99); percentile_90 = percentile.evaluate(90); median = Math.max(1d, percentile.evaluate(50)); max = StatUtils.max(rawDataAsArray); mean = new Mean().evaluate(rawDataAsArray); stddev = new StandardDeviation().evaluate(rawDataAsArray); } computedData.set(getCopyOfComputedData()); }