<commit_before>package org.scalameter

object Aggregator {

  implicit final class SeqDoubleOps(val sq: Seq[Double]) extends AnyVal {
    def mean = sq.sum / sq.size

    def stdev: Double = {
      val m = mean
      var s = 0.0
      for (v <- sq) {
        val diff = v - m
        s += diff * diff
      }
      math.sqrt(s / (sq.size - 1))
    }
  }

  case class Statistic(min: Double, max: Double, average: Double, stdev: Double, median: Double)

  def apply(n: String)(f: Seq[Double] => Double) = new Aggregator {
    def name = n
    def apply(times: Seq[Double]) = f(times)
    def data(times: Seq[Double]) = Measurement.Data(times, true)
  }

  def min = Aggregator("min") { _.min }

  def max = Aggregator("max") { _.max }

  def median = Aggregator("median") {
    xs =>
    val sorted = xs.sorted
    sorted(sorted.size / 2)
  }

  def average = Aggregator("average") { _.mean }

  def stdev = Aggregator("stdev") { _.stdev }

  @deprecated("Unnecessary, use a directly", "0.5")
  def complete(a: Aggregator) = a
}

trait Aggregator extends (Seq[Double] => Double) with Serializable {
  def name: String
  def apply(times: Seq[Double]): Double
  def data(times: Seq[Double]): Measurement.Data
}<commit_msg>Removed unused and duplicated code from Aggregator<commit_after>package org.scalameter

object Aggregator {

  def apply(n: String)(f: Seq[Double] => Double) = new Aggregator {
    def name = n
    def apply(times: Seq[Double]) = f(times)
    def data(times: Seq[Double]) = Measurement.Data(times, true)
  }

  def min = Aggregator("min") { _.min }

  def max = Aggregator("max") { _.max }

  def median = Aggregator("median") {
    xs =>
    val sorted = xs.sorted
    sorted(sorted.size / 2)
  }

  def average = Aggregator("average") { utils.Statistics.mean }

  def stdev = Aggregator("stdev") { utils.Statistics.stdev }

  @deprecated("Unnecessary, use a directly", "0.5")
  def complete(a: Aggregator) = a
}

trait Aggregator extends (Seq[Double] => Double) with Serializable {
  def name: String
  def apply(times: Seq[Double]): Double
  def data(times: Seq[Double]): Measurement.Data
}
{'fraction_non_alphanumeric': 0.13819214387127307, 'fraction_numerical': 0.004259346900141978, 'mean_word_length': 3.228, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, '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': '7651510', 'n_tokens_mistral': 756, 'n_tokens_neox': 718, 'n_words': 202}