# saulabs/trueskill

### Subversion checkout URL

You can clone with
or
.

Implemented score based bayesian rating method

commit 522b201f378dedd7b46b7a4940b2e0169ecc62b7 1 parent fc79906
Markus Düttmann authored
 @@ -6,6 +6,8 @@ trueskill is a rating-system for games with an arbitrary number of teams and pla Usage ----- +### Factor Graph + Example: require 'rubygems' @@ -25,6 +27,38 @@ Example: # update the Ratings graph.update_skills + + +### Score Based Bayesian Rating + +As an extension of the basic TrueSkill algorithm, a score based Bayesian rating method +is implemented. Similar to the standard approach, the actual skill is updated based on +the outcome of the game. Instead of ranks, the score difference of playes determines +the skill updates. + +The approach implemented is a generalization of the Gaussian Score Difference model as proposed in +[Score-based Bayesian Skill Learning](http://users.cecs.anu.edu.au/~sguo/sbsl_ecml2012.pdf). + +Example: + + require 'rubygems' + require 'saulabs/trueskill' + + include Saulabs::TrueSkill + + # team 1 has just one player with a mean skill of 27.1, a skill-deviation of 2.13 + # and an play activity of 100 % + team1 = [Rating.new(27.1, 2.13, 1.0)] + + # team 2 has two players + team2 = [Rating.new(22.0, 0.98, 0.8), Rating.new(31.1, 5.33, 0.9)] + + # team 1 wins by 10 points against team 2 + graph = ScoreBasedBayesianRating.new(team1 => 10.0, team2 => -10.0) + + # update the Ratings + graph.update_skills + Installation ------------ @@ -45,7 +79,8 @@ Known issues Plans ----- -* +* Generalize the method from the team vs team case to a general case with arbitrary number of teams + Note on Patches/Pull Requests -----------------------------
4 lib/saulabs/trueskill.rb
 @@ -4,7 +4,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), "gauss.rb")) %w( - base greater_than + base + greater_than likelihood prior weighted_sum @@ -37,6 +38,7 @@ %w( rating factor_graph + score_based_bayesian_rating ).each do |name| require File.expand_path(File.join(File.dirname(__FILE__), "trueskill", "#{name}.rb")) end
3  lib/saulabs/trueskill/factor_graph.rb
 @@ -101,6 +101,7 @@ def draw_margin # # @return [Float] the probability of the games outcome def update_skills + #puts " vorher = #{@layers.map(&:input).inspect}}" build_layers run_schedule @teams.each_with_index do |team, i| @@ -109,6 +110,7 @@ def update_skills end end ranking_probability + end private @@ -137,6 +139,7 @@ def build_layers layer.input = output layer.build output = layer.output + end end
2  lib/saulabs/trueskill/rating.rb
 @@ -18,7 +18,7 @@ def tau=(value) @tau = value @tau_squared = value**2 end - + end end
123 lib/saulabs/trueskill/score_based_bayesian_rating.rb