Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/saulabs/trueskill/factor_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ def initialize(ranks_teams_hash, options = {})
opts = {
:beta => 25/6.0,
:draw_probability => 0.1,
:skills_additive => true
:skills_additive => true,
:max_delta => 0.0001
}.merge(options)

@beta = opts[:beta]
@draw_probability = opts[:draw_probability]
@beta_squared = @beta**2
@epsilon = -Math.sqrt(2.0 * @beta_squared) * Gauss::Distribution.inv_cdf((1.0 - @draw_probability) / 2.0)
@max_delta = opts[:max_delta]
@skills_additive = opts[:skills_additive]

@prior_layer = Layers::PriorToSkills.new(self, @teams)
Expand All @@ -88,7 +90,8 @@ def initialize(ranks_teams_hash, options = {})
Layers::PerformancesToTeamPerformances.new(self, @skills_additive),
Layers::IteratedTeamPerformances.new(self,
Layers::TeamPerformanceDifferences.new(self),
Layers::TeamDifferenceComparision.new(self, @ranks)
Layers::TeamDifferenceComparision.new(self, @ranks),
@max_delta
)
]
end
Expand Down
5 changes: 3 additions & 2 deletions lib/saulabs/trueskill/layers/iterated_team_performances.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ module Layers
# @private
class IteratedTeamPerformances < Base

def initialize(graph, team_perf_diff, team_diff_comp)
def initialize(graph, team_perf_diff, team_diff_comp,max_delta=0.0001)
super(graph)
@tpd = team_perf_diff
@tdc = team_diff_comp
@max_delta = max_delta
end

def build
Expand Down Expand Up @@ -65,7 +66,7 @@ def multiple_team_loop_schedule
Schedules::Step.new(@tpd.factors[team_diff-1-i], 1)
])
})
Schedules::Loop.new(Schedules::Sequence.new([forward_schedule, backward_schedule]), 0.0001)
Schedules::Loop.new(Schedules::Sequence.new([forward_schedule, backward_schedule]), @max_delta)
end

end
Expand Down