Kemeny-Young method for rank aggregation of incomplete rankings with ties
Project description
This package implements methods for rank aggregation of incomplete rankings with ties
Installation
Install from PyPI:
pip3 install --user corankco
Example usage
>>> from corankco.dataset import Dataset >>> from corankco.scoringscheme import ScoringScheme >>> from corankco.kemrankagg import KemRankAgg >>> from corankco.algorithms.enumeration import Algorithm >>> >>> d = Dataset([ ... [[1], [2, 3]], ... [[3, 1], [4]], ... [[1], [5], [3, 2]] ... ]) >>> print(d.description()) Dataset description: elements:5 rankings:3 complete:False with ties: True rankings: r1 = [[1], [2, 3]] r2 = [[3, 1], [4]] r3 = [[1], [5], [3, 2]]
>>> # Generates default scoring scheme >>> sc = ScoringScheme()
>>> # Consensus computation with an exact algorithm >>> consensus = KemRankAgg.compute_consensus(d, sc, Algorithm.Exact)
>>> print(consensus.description()) Consensus description: computed by:Exact algorithm ILP Cplex necessarily optimal:True kemeny score:6.0 consensus: c1 = [[1], [2, 3], [4], [5]] c2 = [[1], [2, 3], [5], [4]]
>>> # Consensus computation with an heuristic consensus = KemRankAgg.compute_consensus(d, sc, Algorithm.ParCons)
>>> print(consensus.description()) Consensus description: weak partitioning (one optimal solution)[{1}, {2, 3}, {5}, {4}] kemeny score:6.0 necessarily optimal:True computed by:ParCons, uses BioConsert on groups of size > 80 consensus: c1 = [[1], [2, 3], [5], [4]]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
corankco-0.0.7.tar.gz
(13.0 kB
view hashes)
Built Distribution
corankco-0.0.7-py3-none-any.whl
(24.3 kB
view hashes)