PyFLAGR is a Python library built on top of FLAGR. It provides easy access to the algorithm implementations of FLAGR from standard Python programs. PyFLAGR has been designed with simplicity in mind: with only a few lines of code the programmer may efficiently execute complex rank aggregation methods and get the results in a Pandas Dataframe.
From a technical perspective, PyFLAGR links to the FLAGR shared/dynamic link library and makes use of its reference functions (namely, its exposed C functions) to pass the user-defined parameters and perform rank aggregation. In the sequel, it simply reads the output files that are produced by FLAGR and stores their contents in Pandas Dataframes. The Dataframes are then returned to the user.
PyFLAGR consists of the following modules:
RAM: It implements theRAMbase class that is responsible for several functional procedures like the library I/O, the linkage and loading of the FLAGR shared library, Dataframe handling, and so on. All the other classes of PyFLAGR derive from this class.Linear: It includes several classes that execute linear combination rank aggregation methods (CombSUM, CombMNZ, Borda Count).Majoritarian: It includes several classes that execute majoritarian rank aggregation methods (Condorcet Winners, Copeland Winners, Outranking Approach of Farah and Vanderpooten, 2007).MarkovChains: It executes the algorithms which are based on Markov Chains (MC1, MC2, MC3, MC4, see Dwork et al., 2001).Weighted: It executes the rank aggregation methods that automatically determine the voter weights in an unsupervised learning fashion (Preference Relations Method of Desarkar et al., 2016, Agglomerative Aggregation method of Chatterjee et al., 2018, Iterative Distance-based method of Akritidis et al., 2022).Kemeny: It executes Kemeny optimal aggregation (brute force, NP-Hard implementation).RRA: It executes the Robust Rank Aggregation (RRA) method of Kolde et al., 2012.
Please refer to the Publications page for more information about the relevant papers.
The following interactive block diagram depicts the architecture of PyFLAGR and its linkage to the FLAGR shared library.
