Compute rankings in Python.
Project description
Ranky
Compute rankings in Python.
Get started
pip install ranky
import ranky as rk
Read the documentation.
Main functions
The main functionalities include scoring metrics (e.g. accuracy, roc auc), rank metrics (e.g. Kendall Tau, Spearman correlation), ranking systems (e.g. Majority judgement, Kemeny-Young method) and some measurements (e.g. Kendall's W coefficient of concordance).
Most functions takes as input 2-dimensional numpy.array
or pandas.DataFrame
objects. DataFrame are the best to keep track of the names of each data point.
Let's consider the following preference matrix:
Each row is a candidate and each column is a judge. Here is the results of rk.borda(matrix)
, computing the mean rank of each candidate:
We can see that candidate2 has the best average ranking among the four judges.
Let's display it using rk.show(rk.borda(matrix))
:
Ranking systems
-
Random Dictator.
rk.dictator(m)
-
Score Voting.
rk.score(m)
-
Borda Count.
rk.borda(m)
-
Majority Judgement.
rk.majority(m)
-
Condorcet, p-value Condorcet.
rk.condorcet(m)
,rk.condorcet(m, wins=rk.p_wins)
-
Center.
rk.center(m)
,rk.center(m, method='swap')
, etc. -
Kemeny.
Metrics
-
Scoring metrics.
rk.metric(y_true, y_pred, method='accuracy')
-
Rank correlation coefficients.
rk.corr(r1, r2, method='spearman')
-
Rank distances.
rk.dist(r1, r2, method='levenshtein')
Visualizations
rk.show
, 1D or 2Drk.tsne
, 2D or 3D
Other
- Consensus
- Concordane
- Centrality
- Kendall's W
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 Distributions
Built Distribution
File details
Details for the file ranky-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: ranky-0.0.3-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3acec9e3a0cece5ecac8afae22c35315cce8c2980f96ce0a9b219fe1d874b40 |
|
MD5 | 79c052fc00529090d0a8b90c151ba233 |
|
BLAKE2b-256 | 287b5976bf38804fd7c684ff5b7d5dfcacb0bef710bd4e96c5fe805c6865f7c6 |