Skip to content

thelahunginjeet/pyrankagg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Author: Kevin S. Brown (kevin.brown@oregonstate.edu, github.com/thelahunginjeet)

A pure python package for rank aggregation/voting. Full lists have a variety of
options for ranking algorithms.  Currently, only Borda scoring (with mean, median,
and geometric mean) statistics is supported for partial lists, via conversion to
truncated Borda lists.  This will change over time.

This package depends on code that sorts a dictionary by value.  This is provided by
kbutil.listutil.sort_by_value.  So you either need to install my kbutil package (also
on my github site) or replace that function with your own to sort a dict by value.

There is testing code in the tests/ directory.  To run the tests, just use

	>python setup.py test

See the documentation in the functions for detailed usage and function arguments.  The
ranking functions accept lists of dictionaries of scores or ranks.  For example, if you
have:

scorelist = [{'milk':1.4,'cheese':2.6,'eggs':1.2,'bread':3.0},
             {'milk':2.0,'cheese':3.2,'eggs':2.7,'bread':2.9},
             {'milk':2.7,'cheese':3.0,'eggs':2.5,'bread':3.5}]

in which there are three experts, four items, and scores have been provided (in which
higher score = better), then to aggregate their ranks you would do the following:

	from pyrankagg.rankagg import FullListRankAggregator
	FLRA = FullListRankAggregator()
	aggRanks = FLRA.aggregate_ranks(scorelist)

The aggregate ranks are also returned as a dictionary, with item:rank key-value pairs.

As an example ranklist that you can provide to the PartialListRankAggregator:

ranklist = [{'A':1,'B':3,'C':2},
						{'A':2,'B':1},
						{'A':1,'B':4,'C':3,'D':2}]

This package should be fully compatible with python 3.x as of 06/05/2019.

About

pure python code for rank aggregation/voting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages