rank-aggregation 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/scores ADDED
@@ -0,0 +1,4 @@
1
+ clear-with-noise: 0.213968253968254
2
+ languages: 0.350065325612717
3
+ pairs: 0.333333333333333
4
+ random: 0.479696100794631
data/spec/helper.rb ADDED
@@ -0,0 +1,4 @@
1
+ $: << "#{File.dirname(__FILE__)}/../lib"
2
+
3
+ require "rank-aggregation"
4
+
@@ -0,0 +1,30 @@
1
+ require "helper"
2
+
3
+ describe RankAggregation do
4
+ it "should aggregate a single rank into itself" do
5
+ r = (1..10).to_a
6
+ RankAggregation.combine_rankings([r]).should == r
7
+ end
8
+
9
+
10
+ it "should elect the condorcet winner" do
11
+ RankAggregation.combine_rankings([
12
+ [1, 2, 3],
13
+ [1, 3, 2]
14
+ ])[0].should == 1
15
+ end
16
+
17
+ it "should go with the greater majority in cases of ambiguity" do
18
+ a = [1, 2, 3]
19
+ b = [2, 3, 1]
20
+ c = [3, 1, 2]
21
+
22
+ r1 = [a] * 11 + [b] * 10 + [c] * 10
23
+ r2 = [a] * 10 + [b] * 11 + [c] * 10
24
+ r3 = [a] * 10 + [b] * 10 + [c] * 11
25
+
26
+ RankAggregation.combine_rankings(r1).should == a
27
+ RankAggregation.combine_rankings(r2).should == b
28
+ RankAggregation.combine_rankings(r3).should == c
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rank-aggregation
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - David R. MacIver
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-20 00:00:00 +01:00
19
+ default_executable: rank
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: trollop
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description:
36
+ email: david@drmaciver.com
37
+ executables:
38
+ - rank
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.markdown
43
+ files:
44
+ - README.markdown
45
+ - Rakefile
46
+ - VERSION
47
+ - bin/rank
48
+ - lib/rank-aggregation.rb
49
+ - lib/rank-aggregation/markov.rb
50
+ - lib/rank-aggregation/ordering.rb
51
+ - lib/rank-aggregation/ranker.rb
52
+ - lib/rank-aggregation/scorer.rb
53
+ - notes/algorithm.markdown
54
+ - rank-aggregation.gemspec
55
+ - samples/clear-with-noise
56
+ - samples/languages
57
+ - samples/pairs
58
+ - samples/random
59
+ - scores
60
+ - spec/helper.rb
61
+ - spec/rank-aggregation_spec.rb
62
+ has_rdoc: true
63
+ homepage: http://github.com/DRMacIver/rank-aggregation
64
+ licenses: []
65
+
66
+ post_install_message:
67
+ rdoc_options:
68
+ - --charset=UTF-8
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.3.7
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: Turn a collection of individual preferences on items into an aggregate rank for those preferences
96
+ test_files:
97
+ - spec/rank-aggregation_spec.rb
98
+ - spec/helper.rb