Class: LikelihoodFactor

Inherits:
Factor
  • Object
show all
Defined in:
lib/TrueSkill/FactorGraph/LikelihoodFactor.rb

Instance Attribute Summary

Attributes inherited from Factor

#vars

Instance Method Summary collapse

Methods inherited from Factor

#var

Constructor Details

#initialize(mean_var, value_var, variance) ⇒ LikelihoodFactor


6
7
8
9
10
11
# File 'lib/TrueSkill/FactorGraph/LikelihoodFactor.rb', line 6

def initialize(mean_var,value_var,variance)
  super([mean_var,value_var])
  @mean=mean_var
  @value=value_var
  @variance=variance
end

Instance Method Details

#downObject


13
14
15
16
17
18
19
# File 'lib/TrueSkill/FactorGraph/LikelihoodFactor.rb', line 13

def down
  val=@mean
  msg=val/@mean[self]
  pi=1.0/@variance
  a=pi/(pi+val.pi)
  return @value.update_message(self,a*msg.pi,a*msg.tau)
end

#to_sObject


27
28
29
# File 'lib/TrueSkill/FactorGraph/LikelihoodFactor.rb', line 27

def to_s
  return "<LiklihoodFactor "+self.object_id.to_s+">"
end

#upObject


21
22
23
24
25
26
# File 'lib/TrueSkill/FactorGraph/LikelihoodFactor.rb', line 21

def up
  val=@value
  msg=val/@value[self]
  a=1.0/(1.0+@variance*msg.pi)
  return @mean.update_message(self,a*msg.pi,a*msg.tau)
end