<commit_before>package com.xoba.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;

/**
 * various statistical methods
 * 
 */
public class MraStats {

	private MraStats() {
	}

	public static double getPercentile(Collection<? extends Number> c, double fraction) {
		return getPercentiles(c, new double[] { fraction })[0];
	}

	public final static double[] getQuintiles(final Collection<? extends Number> c) {
		return getPercentiles(c, new double[] { 0, 0.2, 0.4, 0.6, 0.8, 1.0 });<commit_msg>percentile of a value within a distribution (not that efficient!)<commit_after>package com.xoba.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;

/**
 * various statistical methods
 * 
 */
public class MraStats {

	private MraStats() {
	}

	public static double getPercentileOfValue(Collection<? extends Number> c, double value) {
		Number[] array = c.toArray(new Number[c.size()]);
		Arrays.sort(array);
		int index = -1;
		for (int i = 0; i < array.length && index < 0; i++) {
			if (value <= array[i].doubleValue()) {
				index = i;
			}
		}
		return 100.0 * index / (c.size() - 1);
	}

	public static double getPercentile(Collection<? extends Number> c, double fraction) {
		return getPercentiles(c, new double[] { fraction })[0];
	}

	public final static double[] getQuintiles(final Collection<? extends Number> c) {
		return getPercentiles(c, new double[] { 0, 0.2, 0.4, 0.6, 0.8, 1.0 });
{'fraction_non_alphanumeric': 0.13641188959660297, 'fraction_numerical': 0.016985138004246284, 'mean_word_length': 4.355113636363637, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 8, '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': '6251855', 'n_tokens_mistral': 654, 'n_tokens_neox': 614, 'n_words': 177}