private static double maf(Predictors<MultiClassLabel> correct, Predictors<MultiClassLabel> answer) {
        TIntIntMap tp = new TIntIntHashMap();
        TIntIntMap fp = new TIntIntHashMap();
        TIntIntMap fn = new TIntIntHashMap();
        TIntSet classes = new TIntHashSet();

        for(int r=0; r < correct.size(); r++) {
            classes.addAll(correct.get(r).getClasses());
            classes.addAll(answer.get(r).getClasses());
            TIntSet cor = new TIntHashSet();
            cor.addAll(correct.get(r).getClasses());
            TIntSet ans = new TIntHashSet();
            ans.addAll(answer.get(r).getClasses());

            for(int a : ans.toArray()) {
                if (cor.contains(a)) {
                    tp.adjustOrPutValue(a, 1, 1);
                } else {
                    fp.adjustOrPutValue(a, 1, 1);
                }
            }
            for(int c : cor.toArray()) {
                if (!ans.contains(c)) {
                    fn.adjustOrPutValue(c, 1, 1);
                }
            }
        }

        double map  = 0;
        double mar = 0;
        for (int c : classes.toArray()) {
            if (tp.get(c) != 0) {
                map += tp.get(c) / (tp.get(c) + fp.get(c));
                mar += tp.get(c) / (tp.get(c) + fn.get(c));
            }
        }
        map /= classes.size();
        mar /= classes.size();
        return 2*map*mar / (map + mar);
    }