File: bayesian_memory_benchmark.rb

package info (click to toggle)
ruby-classifier-reborn 2.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,424 kB
  • sloc: ruby: 2,021; makefile: 7
file content (25 lines) | stat: -rwxr-xr-x 633 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# encoding: utf-8

require File.dirname(__FILE__) + '/../test_helper'
require_relative './bayesian_common_benchmarks'
require_relative '../data/test_data_loader'

class BayesianMemoryBenchmark < Minitest::Benchmark
  include BayesianCommonBenchmarks

  def self.bench_range
    BayesianCommonBenchmarks.bench_range
  end

  def setup
    @data = TestDataLoader.sms_data
    if insufficient_data?
      TestDataLoader.report_insufficient_data(@data.length, MAX_RECORDS)
      skip
    end
    @classifiers = {}
    self.class.bench_range.each do |n|
      @classifiers[n] = ClassifierReborn::Bayes.new 'Ham', 'Spam'
    end
  end
end