Permalink
Browse files

update skills inplace

  • Loading branch information...
1 parent 533bb99 commit 010b9334c2e9b1c9dfcc000f0d99272e714c246d @larskuhnt larskuhnt committed Apr 26, 2010
Showing with 15 additions and 3 deletions.
  1. +8 −2 lib/saulabs/trueskill/factor_graph.rb
  2. +7 −1 lib/saulabs/trueskill/rating.rb
@@ -30,10 +30,15 @@ def draw_margin
Gauss::Distribution.inv_cdf(0.5*(@draw_probability + 1)) * Math.sqrt(1 + 1) * @beta
end
- def evaluate
+ def update_skills
build_layers
run_schedule
- [ranking_probability, updated_skills]
+ @teams.each_with_index do |team, i|
+ team.each_with_index do |player, j|
+ player.replace(@prior_layer.output[i][j])
+ end
+ end
+ ranking_probability
end
private
@@ -49,6 +54,7 @@ def ranking_probability
# end
# end
# Math.exp(sum_log_z + sum_log_s)
+ 0.0
end
def updated_skills
@@ -3,7 +3,8 @@ module TrueSkill
class Rating < Gauss::Distribution
- attr_reader :activity, :tau, :tau_squared
+ attr_accessor :activity
+ attr_reader :tau, :tau_squared
def initialize(mean, deviation, activity = 1.0, tau = 25/300.0)
super(mean, deviation)
@@ -12,6 +13,11 @@ def initialize(mean, deviation, activity = 1.0, tau = 25/300.0)
@tau_squared = @tau**2
end
+ def tau=(value)
+ @tau = value
+ @tau_squared = value**2
+ end
+
end
end

0 comments on commit 010b933

Please sign in to comment.