public static double P_Harmonic(int Y[][],int Ypred[][]){
  int allMissings=0;
  int N=Y.length;
  double loss=0.0;
  for (int i=0; i < N; i++) {
    if (allMissing(Y[i])) {
      allMissings++;
      continue;
    }
    double curLoss=P_Harmonic(Y[i],Ypred[i]);
    if (Double.isNaN(curLoss)) {
      allMissings++;
      continue;
    }
    loss+=curLoss;
  }
  return loss / (double)(N - allMissings);
}

public static double P_Harmonic ( int Y [ ] [ ] , int Ypred [ ] [ ] ) { int allMissings = 0 ; int N = Y . length ; double loss = 0.0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( allMissing ( Y [ i ] ) ) { allMissings ++ ; continue ; } double curLoss = P_Harmonic ( Y [ i ] , Ypred [ i ] ) ; if ( Double . isNaN ( curLoss ) ) { allMissings ++ ; continue ; } loss += curLoss ; } return loss / ( double ) ( N - allMissings ) ; }
harmonic accuracy - - average over all labels . multi - label only .
