<commit_before>import irproject.IRProjectHelper;
import it.acubelab.tagme.RelatednessMeasure;

/**
 * @author  <NAME> <EMAIL>
 * @version 0.0.1
 */
public class Probability extends RelatednessMeasure {

    public Probability (String lang) {
        super(lang);
    }

    @Override
    public float rel (int first, int second) {
        int[] outFirst = IRProjectHelper.getOutlinks(first);
        int[] outSecond = IRProjectHelper.getOutlinks(second);

        double actualIntersectionSize = (double) getIntersectionSize(outFirst, outSecond);
        double expectedIntersectionSize = ((double) (outFirst.length * outSecond.length)) * P;
        double result = actualIntersectionSize - expectedIntersectionSize;

        // System.out.println("outFirst=" + outFirst.length + " outSecond=" + outSecond.length + " expectedSize=" + (int) Math.floor(expectedIntersectionSize) + " actualSize=" + actualIntersectionSize);

        if (result <= 0) {
            return (float) 0;
        } else {
            /* Estimates the cumulative distribution function of an unknown
             * distribution using a generalized logistic function whose
             * parameters were determined by trial and error.
             */
            return (float) (1 / (1 + Math.exp(B * (result - M))));
        }
    }
    
    /**
     * The growth rate of the generalised logistic function.
     * See http://en.wikipedia.org/wiki/Generalised_logistic_function
     */
    private static double B = -0.25;
<commit_msg>Change type of actualIntersectionSize.<commit_after>import irproject.IRProjectHelper;
import it.acubelab.tagme.RelatednessMeasure;

/**
 * @author  <NAME> <EMAIL>
 * @version 0.0.1
 */
public class Probability extends RelatednessMeasure {

    public Probability (String lang) {
        super(lang);
    }

    @Override
    public float rel (int first, int second) {
        int[] outFirst = IRProjectHelper.getOutlinks(first);
        int[] outSecond = IRProjectHelper.getOutlinks(second);

        int actualIntersectionSize = getIntersectionSize(outFirst, outSecond);
        double expectedIntersectionSize = ((double) (outFirst.length * outSecond.length)) * P;
        double result = (double) actualIntersectionSize - expectedIntersectionSize;

        // System.out.println("outFirst=" + outFirst.length + " outSecond=" + outSecond.length + " expectedSize=" + (int) Math.floor(expectedIntersectionSize) + " actualSize=" + actualIntersectionSize);

        if (result < 0) {
            return (float) 0;
        } else {
            /* Estimates the cumulative distribution function of an unknown
             * distribution using a generalized logistic function whose
             * parameters were determined by trial and error.
             */
            return (float) (1 / (1 + Math.exp(B * (result - M))));
        }
    }
    
    /**
     * The growth rate of the generalised logistic function.
     * See http://en.wikipedia.org/wiki/Generalised_logistic_function
     */
    private static double B = -0.25;

{'fraction_non_alphanumeric': 0.10550609957138148, 'fraction_numerical': 0.006594131223211342, 'mean_word_length': 2.731857318573186, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '1737457', 'n_tokens_mistral': 839, 'n_tokens_neox': 804, 'n_words': 219}