public static double ssReg(double[] residuals,double[] targetAttribute){
  double mean=sum(targetAttribute) / targetAttribute.length;
  double ret=0;
  for (int i=0; i < residuals.length; i++) {
    ret+=Math.pow(residuals[i] - mean,2);
  }
  return ret;
}

public static double ssReg ( double [ ] residuals , double [ ] targetAttribute ) { double mean = sum ( targetAttribute ) / targetAttribute . length ; double ret = 0 ; for ( int i = 0 ; i < residuals . length ; i ++ ) { ret += Math . pow ( residuals [ i ] - mean , 2 ) ; } return ret ; }
how much of the variance is explained by the regression
