Class: Saulabs::TrueSkill::Factors::Likelihood
- Defined in:
- lib/saulabs/trueskill/factors/likelihood.rb
Instance Method Summary collapse
-
#initialize(beta_squared, variable1, variable2) ⇒ Likelihood
constructor
A new instance of Likelihood.
- #log_normalization ⇒ Object
- #update_message_at(index) ⇒ Object
Methods inherited from Base
#bind, #message_count, #reset_marginals, #send_message_at
Constructor Details
#initialize(beta_squared, variable1, variable2) ⇒ Likelihood
Returns a new instance of Likelihood.
10 11 12 13 14 15 |
# File 'lib/saulabs/trueskill/factors/likelihood.rb', line 10 def initialize(beta_squared, variable1, variable2) super() @precision = 1.0 / beta_squared bind(variable1) bind(variable2) end |
Instance Method Details
#log_normalization ⇒ Object
25 26 27 |
# File 'lib/saulabs/trueskill/factors/likelihood.rb', line 25 def log_normalization Gauss::Distribution.log_ratio_normalization(@variables[0], @messages[0]) end |
#update_message_at(index) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/saulabs/trueskill/factors/likelihood.rb', line 17 def (index) raise "illegal message index: #{index}" if index < 0 || index > 1 case index when 0 then update_helper(@messages[0], @messages[1], @variables[0], @variables[1]) when 1 then update_helper(@messages[1], @messages[0], @variables[1], @variables[0]) end end |