Class: Saulabs::TrueSkill::FactorGraph
- Inherits:
-
Object
- Object
- Saulabs::TrueSkill::FactorGraph
- Defined in:
- lib/saulabs/trueskill/factor_graph.rb
Instance Attribute Summary collapse
-
#beta ⇒ Object
readonly
Returns the value of attribute beta.
-
#beta_squared ⇒ Object
readonly
Returns the value of attribute beta_squared.
-
#draw_probability ⇒ Object
readonly
Returns the value of attribute draw_probability.
-
#epsilon ⇒ Object
readonly
Returns the value of attribute epsilon.
-
#layers ⇒ Object
readonly
Returns the value of attribute layers.
-
#teams ⇒ Object
readonly
Returns the value of attribute teams.
Instance Method Summary collapse
- #draw_margin ⇒ Object
- #evaluate ⇒ Object
-
#initialize(teams, ranks, options = {}) ⇒ FactorGraph
constructor
teams: 2 dimensional array of ratings.
Constructor Details
#initialize(teams, ranks, options = {}) ⇒ FactorGraph
teams: 2 dimensional array of ratings
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 9 def initialize(teams, ranks, = {}) @teams = teams @ranks = ranks @beta = [:beta] || 25/6.0 @draw_probability = [:draw_probability] || 0.1 @beta_squared = @beta**2 @epsilon = -Math.sqrt(2.0 * @beta_squared) * Gauss::Distribution.inv_cdf((1.0 - @draw_probability) / 2.0) @prior_layer = Layers::PriorToSkills.new(self, @teams) @layers = [ @prior_layer, Layers::SkillsToPerformances.new(self), Layers::PerformancesToTeamPerformances.new(self), Layers::IteratedTeamPerformances.new(self, Layers::TeamPerformanceDifferences.new(self), Layers::TeamDifferenceComparision.new(self, ranks) ) ] end |
Instance Attribute Details
#beta ⇒ Object (readonly)
Returns the value of attribute beta.
6 7 8 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 6 def beta @beta end |
#beta_squared ⇒ Object (readonly)
Returns the value of attribute beta_squared.
6 7 8 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 6 def beta_squared @beta_squared end |
#draw_probability ⇒ Object (readonly)
Returns the value of attribute draw_probability.
6 7 8 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 6 def draw_probability @draw_probability end |
#epsilon ⇒ Object (readonly)
Returns the value of attribute epsilon.
6 7 8 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 6 def epsilon @epsilon end |
#layers ⇒ Object (readonly)
Returns the value of attribute layers.
6 7 8 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 6 def layers @layers end |
#teams ⇒ Object (readonly)
Returns the value of attribute teams.
6 7 8 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 6 def teams @teams end |
Instance Method Details
#draw_margin ⇒ Object
29 30 31 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 29 def draw_margin Gauss::Distribution.inv_cdf(0.5*(@draw_probability + 1)) * Math.sqrt(1 + 1) * @beta end |
#evaluate ⇒ Object
33 34 35 36 37 |
# File 'lib/saulabs/trueskill/factor_graph.rb', line 33 def evaluate build_layers run_schedule [ranking_probability, updated_skills] end |