Java Collection Mean getMean(Collection cluster)

Here you can find the source of getMean(Collection cluster)

Description

get Mean

License

Open Source License

Declaration

public static double[] getMean(Collection<double[]> cluster) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static double[] getMean(Collection<double[]> cluster) {
        int l = cluster.iterator().next().length;
        double[] r = new double[l];
        for (double[] d : cluster)
            for (int i = 0; i < l; i++)
                r[i] += d[i];/*from www .j av a2  s .  c  o m*/
        for (int i = 0; i < l; i++)
            r[i] /= cluster.size();
        return r;
    }
}

Related

  1. calculateMean(Collection values)
  2. calculateMean(Collection values)
  3. calculateMean(Collection values)
  4. getMean(Collection data)
  5. getMean(final Collection collection)
  6. getVariance(Collection data, Number mean)
  7. mean(Collection coll)
  8. mean(Collection nums)