public static double F1(int s1[],int s2[]){
  double p=P_Precision(s1,s2);
  double r=P_Recall(s1,s2);
  if (Double.isNaN(r) || Double.isNaN(p)) {
    return Double.NaN;
  }
  if (p == 0.0 && r == 0.0)   return 0.0;
  return 2. * p * r / (p + r);
}

public static double F1 ( int s1 [ ] , int s2 [ ] ) { double p = P_Precision ( s1 , s2 ) ; double r = P_Recall ( s1 , s2 ) ; if ( Double . isNaN ( r ) || Double . isNaN ( p ) ) { return Double . NaN ; } if ( p == 0.0 && r == 0.0 ) return 0.0 ; return 2. * p * r / ( p + r ) ; }
f1 - the f1 measure for two sets .
