Java Mean Calculate computeMeanSquaredError(double[] trueValues, double[] predValues)

Here you can find the source of computeMeanSquaredError(double[] trueValues, double[] predValues)

Description

compute Mean Squared Error

License

Apache License

Declaration

public static double computeMeanSquaredError(double[] trueValues, double[] predValues) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double computeMeanSquaredError(double[] trueValues, double[] predValues) {
        double sse = 0.0;
        for (int i = 0; i < trueValues.length; i++) {
            double diff = trueValues[i] - predValues[i];
            sse += diff * diff;/*from   w ww  . j  av a  2  s .  co  m*/
        }
        return sse / trueValues.length;
    }
}

Related

  1. computeMean(double[] results)
  2. computeMean(float[] array)
  3. computeMean(float[] data)
  4. computeMean(int val1, int val2, float ratio)
  5. computeMean(int[][] pixels)
  6. computeMeanSquareError(double[] x, double[] y)
  7. mean(ArrayList values)
  8. mean(ArrayList a)
  9. mean(Double... values)