<commit_before>import * as Distributions from './Distributions';

const { sqrt, PI, exp, log } = Math;
function range(count) { return Array(count).fill().map((_, i) => i); }

export function getDistro(distro, { count, ...rest }) {
  const x = range(count);
  Distributions[distro]({ x, count, ...rest });
}

export function getDistroArray({ count = 100, ...rest } = {}) {
  // Create a common x parameter for all distributions
  const x = range(count);
  console.log(Object.keys(Distributions).map(key => ({
    key,
    x,
    y: x.map((x, i, xs) => Distributions[key]({ x, i, xs, count, ...rest })),
  })))
  return Object.keys(Distributions).map(key => ({
    key,
    x,
    y: x.map((x, i, xs) => Distributions[key]({ x, i, xs, count, ...rest })),
  }));
}
<commit_msg>feat: function to get individual distributions<commit_after>import * as Distributions from './Distributions';

const { sqrt, PI, exp, log } = Math;
function range(count) { return Array(count).fill().map((_, i) => i); }

export function getDistro(distro, { count, ...rest }) {
  const xs = range(count);
  return xs.map(x => Distributions[distro]({ x, xs, count, ...rest }));
}

export function getDistroArray({ count = 100, ...rest } = {}) {
  // Create a common x parameter for all distributions
  const x = range(count);
  console.log(Object.keys(Distributions).map(key => ({
    key,
    x,
    y: x.map((x, i, xs) => Distributions[key]({ x, i, xs, count, ...rest })),
  })))
  return Object.keys(Distributions).map(key => ({
    key,
    x,
    y: x.map((x, i, xs) => Distributions[key]({ x, i, xs, count, ...rest })),
  }));
}

{'fraction_non_alphanumeric': 0.20485678704856788, 'fraction_numerical': 0.0037359900373599006, 'mean_word_length': 3.451523545706371, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '1523172', 'n_tokens_mistral': 565, 'n_tokens_neox': 550, 'n_words': 154}