protected double entropy(double[][] dataZs,double[][] dataWs){
  double entropy=0.0;
  int numInstances=dataZs.length;
  for (int j=0; j < m_numClasses; j++) {
    double m=0.0;
    double sum=0.0;
    for (int i=0; i < numInstances; i++) {
      m+=dataZs[i][j] * dataWs[i][j];
      sum+=dataWs[i][j];
    }
    m/=sum;
    for (int i=0; i < numInstances; i++) {
      entropy+=dataWs[i][j] * Math.pow(dataZs[i][j] - m,2);
    }
  }
  return entropy;
}

protected double entropy ( double [ ] [ ] dataZs , double [ ] [ ] dataWs ) { double entropy = 0.0 ; int numInstances = dataZs . length ; for ( int j = 0 ; j < m_numClasses ; j ++ ) { double m = 0.0 ; double sum = 0.0 ; for ( int i = 0 ; i < numInstances ; i ++ ) { m += dataZs [ i ] [ j ] * dataWs [ i ] [ j ] ; sum += dataWs [ i ] [ j ] ; } m /= sum ; for ( int i = 0 ; i < numInstances ; i ++ ) { entropy += dataWs [ i ] [ j ] * Math . pow ( dataZs [ i ] [ j ] - m , 2 ) ; } } return entropy ; }
helper function to compute entropy from z / w values .
