Package: mc4
Markov Chain Type 4 Rank Aggregationimplementation of MC4 and MCT Rank Aggregation algorithm using PythonDescriptionThis project is all about implementing two of the most popular rank aggregation algorithms,Markov Chain Type 4orMC4andMCT. In the field of Machine Learning and many other scientific problems, several items are often needed to be ranked based on some criterion. However, different ranking schemes order the items based on different preference criteria. Hence the rankings produced by them may differ greatly.Therefore a rank aggregation technique is often used for combining the individual rank lists into a single aggregated ranking. Though there are many rank aggregation algorithms, MC4 and MCT are two of the most renowned ones.ResourceLinks to the original contentsRank Aggregation methods for Web: PDF versionRank Aggregation methods for Web: web versionInstallationFor the latest release,pip install mc4For a specific release,pip install mc4=={version}such aspip install mc4==1.0.0General UsageUsing this package is very easy.Prepare a dataset containing ranks of all the items provided by different algorithms. Seeherefor sample datasets and more info.Use following lines of code to use the package. Make sure to pass arguments according to your dataset otherwise answers will be incorrect.frommc4.algorithmimportmc4_aggregatorimportpandasaspd# Method 1aggregated_ranks=mc4_aggregator('test_dataset_1.csv',header_row=0,index_col=0)# or Method 2df=pd.read_csv('test_dataset_1.csv',header=0,index_col=0)aggregated_ranks=mc4_aggregator(df,header_row=0,index_col=0)print(aggregated_ranks)heretest_dataset_1.csvis a sample dataset containing ranks of different items provided by different algorithms.mc4_aggregatortakes some mandatory and optional arguments -algo (string): algorithm for rank aggregation,mc4ormct, default ismc4order (string): order of the dataset,roworcolumn, default isrow. More on this,here.header_row (int or None): row number of the dataset containing the header, default isNoneindex_col (int or None): column number of the dataset containing the index, default isNoneprecision (float): acceptable error margin for convergence, default is1e-07iterations (int): number of iterations to reach stationary distribution, default is200erg_number (float): small, positive number used to calculate ergodic transition matrix, default is0.15Command Line UsageYou can directly use this package from command line if you have the dataset prepared already.To get help and usage details,~$mc4_aggregator-hor--helpUse with default settings,~$mc4_aggregatordataset.csvSpecify the algorithm for rank aggregation using-aor--algo, options:mc4ormct, default ismc4~$mc4_aggregatordataset.csv-amctSpecify order using-oor--order, options:roworcolumn, default isrow~$mc4_aggregatordataset.csv-ocolumnSpecify header row using-hror--header_row, default isNone~$mc4_aggregatordataset.csv-hr0Specify index column using-icor--index_col, default isNone~$mc4_aggregatordataset.csv-ic0Specify precision using-por--precision, default is1e-07~$mc4_aggregatordataset.csv-p0.000001Specify iterations using-ior--iterations, default is200~$mc4_aggregatordataset.csv-i300Specify ergodic number using-eor--erg_number, default is0.15~$mc4_aggregatordataset.csv-e0.20All together,~$mc4_aggregatordataset.csv-amct-ocolumn-hr0-ic0-p0.000001-i300-e0.20OutputOutput ofmc4_aggregatorwill be a dictionary containing itemwise ranks. In absence of item names, items will be represented using integers.Important LinksFor full documentation, please visitDocumentation WikiTo report issues or request a feature, please visitIssuesFollow author, Ayan Kumar Saha -GitHub|LinkedIn