public final double correlationCoefficient() throws Exception {
  if (m_ClassIsNominal) {
    throw new Exception("Can't compute correlation coefficient: " + "class is nominal!");
  }
  double correlation=0;
  double varActual=m_SumSqrClass - m_SumClass * m_SumClass / (m_WithClass - m_Unclassified);
  double varPredicted=m_SumSqrPredicted - m_SumPredicted * m_SumPredicted / (m_WithClass - m_Unclassified);
  double varProd=m_SumClassPredicted - m_SumClass * m_SumPredicted / (m_WithClass - m_Unclassified);
  if (varActual * varPredicted <= 0) {
    correlation=0.0;
  }
 else {
    correlation=varProd / Math.sqrt(varActual * varPredicted);
  }
  return correlation;
}

public final double correlationCoefficient ( ) throws Exception { if ( m_ClassIsNominal ) { throw new Exception ( "Can't compute correlation coefficient: " + "class is nominal!" ) ; } double correlation = 0 ; double varActual = m_SumSqrClass - m_SumClass * m_SumClass / ( m_WithClass - m_Unclassified ) ; double varPredicted = m_SumSqrPredicted - m_SumPredicted * m_SumPredicted / ( m_WithClass - m_Unclassified ) ; double varProd = m_SumClassPredicted - m_SumClass * m_SumPredicted / ( m_WithClass - m_Unclassified ) ; if ( varActual * varPredicted <= 0 ) { correlation = 0.0 ; } else { correlation = varProd / Math . sqrt ( varActual * varPredicted ) ; } return correlation ; }
returns the correlation coefficient if the class is numeric .
