Skip to content

Commit 5cf3a7b

Browse files
committed
Merge remote-tracking branch 'origin/master' into predict-rank
# Conflicts: # OpenSkillSharp/Models/PlackettLuce.cs # OpenSkillSharp/OpenSkillModelBase.cs
2 parents ad54173 + efac516 commit 5cf3a7b

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

OpenSkillSharp.Tests/Models/Data/plackettluce.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,21 @@
8686
],
8787
"team_2": [
8888
{
89-
"mu": 23.083700519022745,
89+
"mu": 20.599656070925114,
9090
"sigma": 8.222674397835641
9191
},
9292
{
93-
"mu": 21.717476072569045,
93+
"mu": 20.47545384852023,
9494
"sigma": 8.277466291367071
9595
}
9696
],
9797
"team_3": [
9898
{
99-
"mu": 21.717476072569045,
99+
"mu": 20.47545384852023,
100100
"sigma": 8.277466291367071
101101
},
102102
{
103-
"mu": 23.083700519022745,
103+
"mu": 20.599656070925114,
104104
"sigma": 8.222674397835641
105105
}
106106
],
@@ -160,7 +160,7 @@
160160
"ties": {
161161
"team_1": [
162162
{
163-
"mu": 23.241111866333558,
163+
"mu": 21.63766806988004,
164164
"sigma": 8.310709773172306
165165
}
166166
],
@@ -176,15 +176,15 @@
176176
],
177177
"team_3": [
178178
{
179-
"mu": 21.479966996534408,
179+
"mu": 19.87652320008089,
180180
"sigma": 8.237522411103104
181181
},
182182
{
183-
"mu": 21.479966996534408,
183+
"mu": 19.87652320008089,
184184
"sigma": 8.237522411103104
185185
},
186186
{
187-
"mu": 21.479966996534408,
187+
"mu": 19.87652320008089,
188188
"sigma": 8.237522411103104
189189
}
190190
]
@@ -261,4 +261,4 @@
261261
}
262262
]
263263
}
264-
}
264+
}

OpenSkillSharp.Tests/Models/PlackettLuceTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,16 @@ public void Rate_Balance()
149149
// Assert
150150
Assertions.RatingResultsEqual(expectedRatings, results);
151151
}
152+
153+
[Fact]
154+
public void Rate_AllScoresTied()
155+
{
156+
PlackettLuce model = new PlackettLuce { Mu = 30, Sigma = 30.0 / 3 };
157+
158+
ITeam[] teams = [new Team { Players = [model.Rating()] }, new Team { Players = [model.Rating()] }];
159+
ITeam[] result = model.Rate(teams, scores: [0, 0]).ToArray();
160+
161+
Assert.Equal(30, result[0].Players.Single().Mu);
162+
Assert.Equal(30, result[1].Players.Single().Mu);
163+
}
152164
}

OpenSkillSharp/Models/PlackettLuce.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected override IEnumerable<ITeam> Compute(
4444
sumOmega: acc.sumOmega +
4545
(
4646
iTeamIndex == qTeamIndex
47-
? 1 - (iMuOverCeOverSumQ / rankOccurrences[qTeamIndex])
47+
? (1 - iMuOverCeOverSumQ) / rankOccurrences[qTeamIndex]
4848
: -1 * iMuOverCeOverSumQ / rankOccurrences[qTeamIndex]
4949
),
5050
sumDelta: acc.sumDelta +

OpenSkillSharp/OpenSkillModelBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ protected IEnumerable<double> CalculateMarginAdjustedMu(
352352
return (qTeam.Mu - iTeam.Mu) * (marginFactor - 1) * sign;
353353
}
354354
)
355+
.DefaultIfEmpty(0)
355356
.Average();
356357

357358
return qTeam.Mu + muAdjustment;

0 commit comments

Comments
 (0)