Class: Saulabs::TrueSkill::Layers::PerformancesToTeamPerformances

Inherits:
Base
  • Object
show all
Defined in:
lib/saulabs/trueskill/layers/performances_to_team_performances.rb

Instance Attribute Summary

Attributes inherited from Base

#factors, #graph, #input, #output

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Saulabs::TrueSkill::Layers::Base

Instance Method Details

#buildObject



9
10
11
12
13
14
15
# File 'lib/saulabs/trueskill/layers/performances_to_team_performances.rb', line 9

def build
  @input.each do |ratings|
    variable = Gauss::Distribution.new
    @factors << Factors::WeightedSum.new(variable, ratings, ratings.map(&:activity))
    @output << [variable]
  end
end

#posterior_scheduleObject



21
22
23
24
25
26
27
# File 'lib/saulabs/trueskill/layers/performances_to_team_performances.rb', line 21

def posterior_schedule
  steps = []
  @factors.each do |f|
    (1..f.message_count-1).each { |i| steps << Schedules::Step.new(f, i) }
  end
  Schedules::Sequence.new(steps)
end

#prior_scheduleObject



17
18
19
# File 'lib/saulabs/trueskill/layers/performances_to_team_performances.rb', line 17

def prior_schedule
  Schedules::Sequence.new(@factors.map { |f| Schedules::Step.new(f, 0) })
end