Paired comparisons are a standard method to infer a ranking between a series of players/actors. A shortcoming of many of these methods is that they lack mechanisms that allow for partial rankings --rankings where multiple nodes can have the same rank. This package contains models to infer partial rankings from pairwise comparisons as described in https://arxiv.org/abs/2501.02505.
├── environment.yml <- Conda environment configuration file
├── LICENSE <- Open-source license
├── Makefile <- Makefile
├── README.md <- This file.
├── data
│ ├── interim <- Intermediate data that has been transformed.
│ ├── processed <- Final data sets.
│ └── raw <- Original data sets (wolf data set).
│
├── example.ipyb <- Jupyter notebook containing an example use case of the
│ partial_rankings algorithm when applied to a set of dominance
│ interactions among a pack of wolves.
│
├── pyproject.toml <- Project configuration file with package metadata
│
├── requirements.txt <- Requirements file for reproducing the analysis environment.
│
├── setup.cfg <- Configuration file for flake8
│
└── partial_rankings <- Source code for use in this project.
│
├── __init__.py <- Makes partial_rankings a Python module
│
├── dataset.py <- Code to read or generate data
│
├── decos.py <- Useful decorators
│
├── model.py <- Code to fit partial rankings algorithm
│
├── preprocessing.py <- Code to extract information from match lists
│
└── utils.py <- Utility functions
The partial-rankings package can be installed through pip:
pip install partial-rankingsTo ensure that all dependencies are correctly installed it is recommended to create a Conda envrionment from the envrionment.yml file by running
conda env create --file=envrionment.ymlwhich will install the partial-rankings package along with all of its dependencies.
Once the package has been installed it can be imported as
import partial_rakingsBelow is a typical use case:
from partial_rankings.dataset import read_matchlist
from partial_rankings.model import partial_rankings
from partial_rankings.preprocessing import get_N, get_M, get_edges# Load match list
matchlist = read_matchlist("../data/raw/match_lists/wolf.txt")
# Extract algorithm inputs
N = get_N(matchlist) # Number of players
M = get_M(matchlist) # Number of matches
e_out, e_in = get_edges(matchlist) # Out and in edges
# Fit model
model_fit = partial_rankings(N, M, e_out, e_in, full_trace=True)See example.ipynb for further details.