-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrate.rb
More file actions
27 lines (20 loc) · 759 Bytes
/
rate.rb
File metadata and controls
27 lines (20 loc) · 759 Bytes
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
26
27
#!/usr/bin/env ruby
$:.unshift File.expand_path("../lib", __FILE__)
require 'rollup'
class GroupDiff
def initialize(best, actual)
@best_count = best.map(&:first).uniq.size
@actual_count = actual.map(&:first).uniq.size
end
def to_s
"#{(@best_count - @actual_count).abs}"
end
end
best_groups_collector = Rollup::Outputs::GroupedProductOutput.new
Rollup::Inputs::CSVGroupImport.new(best_groups_collector).run(ARGV[0])
best_groups = best_groups_collector.groups
actual_groups_collector = Rollup::Outputs::GroupedProductOutput.new
Rollup::Runner.new(actual_groups_collector).run(ARGV[1], :t1 => ARGV[2].to_f, :t2 => ARGV[3].to_f)
actual_groups = actual_groups_collector.groups
diff = GroupDiff.new(best_groups, actual_groups)
puts diff