Skip to main content

Infer partial rankings from a series of pairwise comparisons.

Project description

partial-rankings

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 PREPRINT.

Project organization

├── 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

Installation

The partial-rankings package can be installed through pip:

pip install partial-rankings

To 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.yml

which will install the partial-rankings package along with all of its dependencies.

Typical usage

Once the package has been installed it can be imported as

import partial_rakings

Below 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.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

partial_rankings-1.0.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

partial_rankings-1.0.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file partial_rankings-1.0.0.tar.gz.

File metadata

  • Download URL: partial_rankings-1.0.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.6

File hashes

Hashes for partial_rankings-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c87aecc47990760c476f13bfabb14b05ad7f192873567e8cf1eb611d0d7d6cfc
MD5 641444166e08f17547c8d7eeafa4a107
BLAKE2b-256 c48a736c755275da0601dc5a634e1613cb107637526e8c07e3f00cb936e36af5

See more details on using hashes here.

File details

Details for the file partial_rankings-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for partial_rankings-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69c2a2894a50bf0a3e242c38bc70c66804aec11dd8d859b5a2be10b025683464
MD5 888456fbc4ebde7309ff133829598d44
BLAKE2b-256 0409b88e241e298e1be7458d782c46664dd7c83c567da45af78da4f5a8a3cfbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page