Closed seanlaw closed 7 years ago
Hi, I emailed the author and he replied to me with the following instructions:
You can fit a Bradley-Terry model as follows:
import choix
import numpy as np
n_items = 5
data = [(1, 0), (1, 4), (1, 2), (3,1), (2,3)]
# Infer Bradley-Terry model parameters.
est = choix.ilsr_pairwise(n_items, data, alpha=1e-5)
# Ranking of the items (from worst to best)
ranking = np.argsort(est)
Two comments.
1) By convention:
a
has won over b
" (in your notation: a > b)2) There are several functions that can compute the maximum-likelihood
estimate. I recommend ilsr_pairwise
, as it is the fastest one in
general. But you might also want to try opt_pairwise
with
method="Newton-CG"
.
@tcloaa, thanks a lot for assisting. (Somehow I did not get notified of this issue.)
@seanlaw: I will soon release a few Jupyter notebooks with a few examples to get started with the library. Stay tuned!
FYI, I've just added two Jupyter notebooks that show how to use the library:
I'd like to build a Bradley Terry model. Could you provide an example please?