Java Utililty Methods Mean Calculate

List of utility methods to do Mean Calculate

Description

The list of methods to do Mean Calculate are organized into topic(s).

Method

doublecomputeMean(double[] data)
Compute mean value of an array of double
double sum = 0;
for (double aData : data) {
    sum += aData;
return sum / data.length;
doublecomputeMean(double[] results)
compute Mean
double mean = 0;
for (double single : results) {
    mean += single;
return mean / results.length;
floatcomputeMean(float[] array)
Computes the mean value of a given array
float mean = 0;
for (int i = 0; i < array.length; i++) {
    mean += array[i];
return mean / array.length;
floatcomputeMean(float[] data)
compute Mean
float sum = 0.0f;
int nPts = 0;
for (int i = 0; i < data.length; i++) {
    if (!Float.isNaN(data[i])) {
        sum += data[i];
        nPts++;
return (nPts == 0 ? Float.NaN : sum / nPts);
intcomputeMean(int val1, int val2, float ratio)
Compute the mean of row values.
return (int) ((1.0f - ratio) * val2 + ratio * val1);
doublecomputeMean(int[][] pixels)
Calcula media de luminocidad de la matriz imagen.
double means;
double sum = 0;
int npix = pixels.length * pixels[0].length;
for (int x = 0; x < pixels.length; x++) {
    for (int y = 0; y < pixels[0].length; y++) {
        sum += pixels[x][y];
means = sum / npix;
return means;
doublecomputeMeanSquaredError(double[] trueValues, double[] predValues)
compute Mean Squared Error
double sse = 0.0;
for (int i = 0; i < trueValues.length; i++) {
    double diff = trueValues[i] - predValues[i];
    sse += diff * diff;
return sse / trueValues.length;
doublecomputeMeanSquareError(double[] x, double[] y)
computes the mean square error of array x to array y
double sum = 0;
for (int i = 0; i < x.length; i++) {
    sum += Math.pow(x[i] - y[i], 2);
return sum / x.length;
Doublemean(ArrayList values)
mean
return sum(values) / values.size();
doublemean(ArrayList a)
mean
return sum(a) / a.size();