<commit_before>'use strict';

const avg = require('../merge/avg');

const Sample = {};

Sample.summarize = function() {
  const result = {};

  Object.keys(this.values).forEach(k => {
    const v = this.values[k].value;

    if( typeof v !== 'number' || Number.isNaN(v) || !Number.isFinite(v) )
      throw new Error('Not a valid sample value: ' + v);

    result[k] = {
      $max : v,
      $min : v,
      $avg : avg.singleton(v),<commit_msg>Report hopefully-better error messages when samples are constructed incorrectly.<commit_after>'use strict';

const avg = require('../merge/avg');

const Sample = {};

Sample.summarize = function() {
  const result = {};

  Object.keys(this.values).forEach(k => {
    const v = this.values[k].value;

    if( typeof v !== 'number' || Number.isNaN(v) || !Number.isFinite(v) )
      throw new Error('Not a valid sample value for ' + k + ': ' + v);

    result[k] = {
      $max : v,
      $min : v,
      $avg : avg.singleton(v),
{'fraction_non_alphanumeric': 0.18125643666323377, 'fraction_numerical': 0.0, 'mean_word_length': 2.935222672064777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1264994', 'n_tokens_mistral': 335, 'n_tokens_neox': 325, 'n_words': 81}