lucasmaystre / choix

Inference algorithms for models based on Luce's choice axiom
MIT License
163 stars 28 forks source link

Ties in rankings #23

Closed rkmaddox closed 2 days ago

rkmaddox commented 2 years ago

I see in #17 some suggestions for handling ties in pairwise comparisons. Is there a way to do that in rankings? Specifically, I have a case where several competitors in a race may not finish, and all of the should be ranked as number of finishers + 1. Is there a way to handle such a condition?

lucasmaystre commented 2 days ago

Apologies for the (very!) delayed reply. The situation you describe can be handled with top-1 lists.

For example, if you have the situation where 0, 1, 2 finish the race (in this order), and 3, 4, 5 did not finish (let's write this as: item0 > item1 > item2 > {item3, item4, item5}), you could do something like

import choix
data = [
    [0, [1, 2, 3, 4, 5]],
    [1, [2, 3, 4, 5]],
    [2, [3, 4, 5]],
]

params = choix.opt_top1(n_items=6, data=data)