Skip to content
DeepForgeby svx
All problems
HardStatisticsst-249

Bradley-Terry MLE Step

Problem

Perform one MM (minorization-maximization) update for the Bradley-Terry model and normalize the strengths to sum to 1. wins[i][j] counts how often player i beat player j, and strengths holds the current positive values. The update is s_i' = W_i / sum over j != i of (wins[i][j] + wins[j][i]) / (s_i + s_j), with winless players left at 0.0. Return [] for empty input.

Hint

The denominator sums games played scaled by the current strength sum for each opponent.

Test cases

case 1
in: [[1,1],[[0,2],[1,0]]]
expected: [0.6666666666666666,0.3333333333333333]
case 2
in: [[1,1,1],[[0,1,0],[0,0,1],[1,0,0]]]
expected: [0.3333333333333333,0.3333333333333333,0.3333333333333333]
case 3
in: [[],[]]
expected: []
case 4
in: [[1,2],[[0,0],[0,0]]]
expected: [0,0]
Starter codePython
def bt_mle_step(strengths, wins):
    # Your code here
    pass

4 test cases · run your code against them in the editor