Description
In plackett_luce.py, lines 902
for rank, indices in rank_groups.items():
if len(indices) > 1:
avg_mu_change = sum(
result[i][0].mu - original_teams[i][0].mu for i in indices
) / len(indices)
for i in indices:
for j in range(len(result[i])):
result[i][j].mu = original_teams[i][j].mu + avg_mu_change
The avg_mu_change will always be 0. This can be verified by adding the line:
print(f"Rank {rank} has {len(indices)} teams. Average mu change: {avg_mu_change}")
after the avg_mu_change is calculated, and running pytest -s
The reason for this appears to be that at this point in the execution, result and original_teams are just aliases of each other, since this code: (plackett_luce.py:896)
modified_player = original_teams[i][j]
modified_player.mu = mu
modified_player.sigma = sigma
Modifies the mu of the player in the original_teams list
Obviously the unit tests do pass, so my question is if the unit tests are comparing against incorrect values that were generated due to this bug, of if this is not a bug at all, and it's ok that this tie adjustment code does nothing. It's unclear to me from looking at why we make this adjustment in case of ties.
Minimal Reproduction
Add:
print(f"Rank {rank} has {len(indices)} teams. Average mu change: {avg_mu_change}")
at plackett_luce.py:907
run pytest -s
Observe that none of the tied teams have an average mu change
Version
v6
Description
In plackett_luce.py, lines 902
The avg_mu_change will always be 0. This can be verified by adding the line:
print(f"Rank {rank} has {len(indices)} teams. Average mu change: {avg_mu_change}")after the avg_mu_change is calculated, and running pytest -s
The reason for this appears to be that at this point in the execution, result and original_teams are just aliases of each other, since this code: (plackett_luce.py:896)
Modifies the mu of the player in the original_teams list
Obviously the unit tests do pass, so my question is if the unit tests are comparing against incorrect values that were generated due to this bug, of if this is not a bug at all, and it's ok that this tie adjustment code does nothing. It's unclear to me from looking at why we make this adjustment in case of ties.
Minimal Reproduction
Add:
print(f"Rank {rank} has {len(indices)} teams. Average mu change: {avg_mu_change}")at plackett_luce.py:907
run pytest -s
Observe that none of the tied teams have an average mu change
Version
v6