<commit_before>package edu.neu.ccs.pyramid.eval;

/**
 * follow the definition in http://en.wikipedia.org/wiki/Precision_and_recall
 * Created by chengli on 10/2/14.
 */
public class FMeasure {

    /**
     *
     * @param precision
     * @param recall
     * @return
     */
    public static double f1(double precision, double recall){
        return fBeta(precision,recall,1);
    }

    /**
     *
     * @param precision
     * @param recall
     * @param beta
     * @return
     */
    public static double fBeta(double precision, double recall, double beta){
        return (1+beta*beta)*precision*recall/(beta*beta*precision + recall);
    }
}<commit_msg>bug fix in fBeta<commit_after>package edu.neu.ccs.pyramid.eval;

/**
 * follow the definition in http://en.wikipedia.org/wiki/Precision_and_recall
 * Created by chengli on 10/2/14.
 */
public class FMeasure {

    /**
     *
     * @param precision
     * @param recall
     * @return
     */
    public static double f1(double precision, double recall){
        return fBeta(precision,recall,1);
    }

    /**
     *
     * @param precision
     * @param recall
     * @param beta
     * @return
     */
    public static double fBeta(double precision, double recall, double beta){
        if (precision==0 || recall==0){
            return 0;
        }
        return (1+beta*beta)*precision*recall/(beta*beta*precision + recall);
    }
}
{'fraction_non_alphanumeric': 0.12437810945273632, 'fraction_numerical': 0.013503909026297086, 'mean_word_length': 2.360381861575179, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7584831', 'n_tokens_mistral': 460, 'n_tokens_neox': 438, 'n_words': 104}