pyRankMCDA is a Python library designed for rank aggregation in multi-criteria decision analysis (MCDA). It provides implementations of classical and modern rank aggregation methods, allowing users to combine multiple rankings into a single consensus ranking. This is particularly useful in fields like decision science, information retrieval, and any domain where synthesizing different ordered lists is necessary.
-
Multiple Rank Aggregation Methods:
- Borda Method
- Copeland Method
- Footrule Rank Aggregation
- Fast Footrule Rank Aggregation
- Kemeny-Young Method
- Fast Kemeny-Young
- Median Rank Aggregation
- PageRank Algorithm
- Plackett-Luce Model Aggregation
- Reciprocal Rank Fusion
- Schulze Method
-
Distance and Correlation Metrics:
- Cayley Distance
- Footrule Distance
- Kendall Tau Distance
- Kendall Tau Correlation
- Spearman Rank Correlation
-
Visualization Tools:
- Heatmaps of rankings
- Radar charts comparing rankings from different methods
- Multidimensional Scaling (MDS) plots for visualizing distances between ranking methods
- Install
pip install pyRankMCDA- Basic Example
import numpy as np
from pyRankMCDA.algorithm import rank_aggregation
# Example rankings from different methods
ranks = np.array([
[1, 2, 3],
[2, 1, 3],
[3, 2, 1]
])
# Initialize rank aggregation object
ra = rank_aggregation(ranks)
# Run Borda method
borda_rank = ra.borda_method(verbose = True)- Running Multiple Methods
# Define the methods to run
methods = ['bd', 'cp', 'fky', 'md', 'pg']
# Run selected methods
df = ra.run_methods(methods)- Visualization
# Plot heatmap of rankings
ra.plot_ranks_heatmap(df)
# Plot radar chart of rankings
ra.plot_ranks_radar(df)- Computing Metrics
# Calculate distance and correlation metrics
d_matrix = ra.metrics(df)
# Plot metric comparisons
ra.metrics_plot(d_matrix)- Try it in Colab:
- Example: ( Colab Demo )
- Others
- 3MOAHP - Inconsistency Reduction Technique for AHP and Fuzzy-AHP Methods
- pyDecision - A library for many MCDA methods
- pyMissingAHP - A Method to Infer AHP Missing Pairwise Comparisons
- ELECTRE-Tree - Algorithm to infer the ELECTRE Tri-B method parameters
- Ranking-Trees - Algorithm to infer the ELECTRE II, III, IV and PROMETHEE I, II, III, IV method parameters
- EC-PROMETHEE - A Committee Approach for Outranking Problems
- MCDM Scheduler - A MCDM approach for Scheduling Problems