trueskill-ranked 1.1 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/TrueSkill.rb +1 -0
- data/lib/TrueSkill/TrueSkill.rb +56 -36
- metadata +4 -3
data/lib/TrueSkill.rb
CHANGED
data/lib/TrueSkill/TrueSkill.rb
CHANGED
@@ -208,40 +208,60 @@ class TrueSkillObject
|
|
208
208
|
end
|
209
209
|
return output
|
210
210
|
end
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
#
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
211
|
+
def match_quality(rating_groups)
|
212
|
+
rating_groups=validate_rating_groups(rating_groups)
|
213
|
+
ratings=rating_groups.flatten
|
214
|
+
length=ratings.length
|
215
|
+
mean_rows=[]
|
216
|
+
ratings.each {|r| mean_rows << [r.mu] }
|
217
|
+
mean_matrix=Matrix.new(mean_rows)
|
218
|
+
variance_matrix=Proc.new do |width,height|
|
219
|
+
Enumerator.new do |yielder|
|
220
|
+
sig=[]
|
221
|
+
ratings.each {|x| sig << (x.sigma**2)}
|
222
|
+
sig.each_with_index do |variance,x|
|
223
|
+
yielder.yield [x,x],variance
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
variance_matrix=Matrix.new(nil,length,length,:func=>variance_matrix)
|
228
|
+
#pp variance_matrix
|
229
|
+
rotated_a_matrix=Proc.new do |set_width,set_height|
|
230
|
+
Enumerator.new do |yielder|
|
231
|
+
t=0
|
232
|
+
r2=0
|
233
|
+
x2=0
|
234
|
+
rating_groups.take(rating_groups.size-1).zip(rating_groups.drop(1)).each_with_index do |y,r|
|
235
|
+
cur=y[0]
|
236
|
+
nex=y[1]
|
237
|
+
z=0
|
238
|
+
(t...t+cur.length).each do |x|
|
239
|
+
yielder.yield [r,x],1
|
240
|
+
t+=1
|
241
|
+
z=x
|
242
|
+
end
|
243
|
+
z+=1
|
244
|
+
(z...z+nex.length).each do |x|
|
245
|
+
pp
|
246
|
+
yielder.yield [r,x],-1
|
247
|
+
z=x
|
248
|
+
end
|
249
|
+
r2=r
|
250
|
+
x2=z
|
251
|
+
end
|
252
|
+
set_width.call(x2+1)
|
253
|
+
set_height.call(r2+1)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
rotated_a_matrix=Matrix.new(nil,nil,nil,:func=>rotated_a_matrix)
|
257
|
+
a_matrix = rotated_a_matrix.transpose()
|
258
|
+
_ata = (@beta ** 2) * rotated_a_matrix * a_matrix
|
259
|
+
_atsa=rotated_a_matrix*(variance_matrix*a_matrix)
|
260
|
+
start=mean_matrix.transpose()*a_matrix
|
261
|
+
middle=_ata+_atsa
|
262
|
+
endv=rotated_a_matrix*mean_matrix
|
263
|
+
e_arg=(-0.5*start*middle.inverse()*endv).determinant()
|
264
|
+
s_arg=_ata.determinant()/middle.determinant()
|
265
|
+
return Math.exp(e_arg)*Math.sqrt(s_arg)
|
266
|
+
end
|
247
267
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trueskill-ranked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '2.0'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,8 @@ bindir: bin
|
|
12
12
|
cert_chain: []
|
13
13
|
date: 2012-06-13 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
|
-
description: A improved TrueSkill with correct ranking order
|
15
|
+
description: A improved TrueSkill with correct ranking order Now with Match Quality
|
16
|
+
also
|
16
17
|
email: kat.swales@nekokittygames.com
|
17
18
|
executables: []
|
18
19
|
extensions: []
|
@@ -32,7 +33,7 @@ files:
|
|
32
33
|
- lib/TrueSkill/FactorGraph/Variable.rb
|
33
34
|
- lib/TrueSkill/Mathematics/general.rb
|
34
35
|
- lib/TrueSkill/Mathematics/guassian.rb
|
35
|
-
homepage:
|
36
|
+
homepage: https://github.com/nekosune/trueskill-ranked
|
36
37
|
licenses: []
|
37
38
|
post_install_message:
|
38
39
|
rdoc_options: []
|