src/core/metrics/ClassificationMetric.java
public double classificationF1Score() {
        if (averageType == AverageType.MACRO) {
            double average = 0;
            int averageCount = 0;
            for (Integer feature : getFeatures()) {
                double TP = getTP(feature);
                double FP = getFP(feature);
                double FN = getFN(feature);
                double precision = TP / (TP + FP);
                double recall =  TP / (TP + FN);
                if (precision + recall > 0) {
                    average += 2 * precision * recall / (precision + recall);
                    averageCount++;
                }
            }
            return averageCount == 0 ? 0 : average / (double)averageCount;
        }
        else {
            double TP = getTPTotal();
            double FP = getFPTotal();
            double FN = getFNTotal();
            double precision = TP / (TP + FP);
            double recall =  TP / (TP + FN);
            return precision + recall > 0 ? 2 * precision * recall / (precision + recall) : 0;
        }
    }
/**
     * Returns classification F1 score.<br>
     * F1 is calculated as 2 * precision * recall / (precision + recall).<br>
     * Takes into consideration if statistics is defined as macro or micro average.<br>
     *
     * @return classification F1 score.
     */
Returns classification F1 score.
F1 is calculated as 2 * precision * recall / (precision + recall).
Takes into consideration if statistics is defined as macro or micro average.

@return classification F1 score.
Returns classification F1 score . F1 is calculated as 2 * precision * recall / ( precision + recall ) . Takes into consideration if statistics is defined as macro or micro average . @return classification F1 score .
public double classificationF1Score() {
        if (averageType == AverageType.MACRO) {
            double average = 0;
            int averageCount = 0;
            for (Integer feature : getFeatures()) {
                double TP = getTP(feature);
                double FP = getFP(feature);
                double FN = getFN(feature);
                double precision = TP / (TP + FP);
                double recall =  TP / (TP + FN);
                if (precision + recall > 0) {
                    average += 2 * precision * recall / (precision + recall);
                    averageCount++;
                }
            }
            return averageCount == 0 ? 0 : average / (double)averageCount;
        }
        else {
            double TP = getTPTotal();
            double FP = getFPTotal();
            double FN = getFNTotal();
            double precision = TP / (TP + FP);
            double recall =  TP / (TP + FN);
            return precision + recall > 0 ? 2 * precision * recall / (precision + recall) : 0;
        }
    }
public double classificationF1Score ( ) { if ( averageType == AverageType . MACRO ) { double average = 0 ; int averageCount = 0 ; for ( Integer feature : getFeatures ( ) ) { double TP = getTP ( feature ) ; double FP = getFP ( feature ) ; double FN = getFN ( feature ) ; double precision = TP / ( TP + FP ) ; double recall = TP / ( TP + FN ) ; if ( precision + recall > 0 ) { average += 2 * precision * recall / ( precision + recall ) ; averageCount ++ ; } } return averageCount == 0 ? 0 : average / ( double ) averageCount ; } else { double TP = getTPTotal ( ) ; double FP = getFPTotal ( ) ; double FN = getFNTotal ( ) ; double precision = TP / ( TP + FP ) ; double recall = TP / ( TP + FN ) ; return precision + recall > 0 ? 2 * precision * recall / ( precision + recall ) : 0 ; } }
Returns classification F1 score.<br>
 F1 is calculated as 2 * precision * recall / (precision + recall).<br>
 Takes into consideration if statistics is defined as macro or micro average.<br>
Returns classification F1 score . <br > F1 is calculated as 2 * precision * recall / ( precision + recall ) . <br > Takes into consideration if statistics is defined as macro or micro average . <br >