median_ranking

class corankco.algorithms.median_ranking.MedianRanking

The MedianRanking class serves as an interface for implementing consensus ranking algorithms. It defines several methods that each consensus ranking algorithm should implement, including the computation of consensus rankings, determining whether a given scoring scheme is relevant for incomplete rankings, and benchmarking the consensus computation time. An algorithm implemented using this interface should also provide a full name and a string representation of itself.

bench_time_consensus(dataset: Dataset, scoring_scheme: ScoringScheme, return_at_most_one_ranking: bool = True, lower_bound_time: float = 1.0) float

Calculate and return the average computation time for a given dataset and scoring scheme

Parameters:
  • dataset (Dataset) – The dataset of rankings to be aggregated.

  • scoring_scheme (ScoringScheme) – The scoring scheme to be used for calculating consensus.

  • return_at_most_one_ranking (bool) – If True, the algorithm should return at most one ranking.

  • lower_bound_time (float) – The lower bound on the total computation time.

Returns:

The average computation time.

Return type:

float

compute_consensus_rankings(dataset: Dataset, scoring_scheme: ScoringScheme, return_at_most_one_ranking: bool = True, bench_mode: bool = False) Consensus

Calculate and return the consensus rankings based on the given dataset and scoring scheme.

Parameters:
  • dataset (Dataset) – The dataset of rankings to be aggregated.

  • scoring_scheme (ScoringScheme) – The scoring scheme to be used for calculating consensus.

  • return_at_most_one_ranking (bool) – If True, the algorithm should return at most one ranking.

  • bench_mode (bool) – If True, the algorithm may return additional information for benchmarking purposes.

Returns:

Consensus rankings. If the algorithm is unable to provide multiple consensuses or

return_at_most_one_ranking is True, a single consensus ranking is returned. :rtype: Consensus :raise ScoringSchemeNotHandledException: When the algorithm cannot compute the consensus because the implementation does not support the given scoring scheme.

get_full_name() str

Get the full name of the algorithm.

Returns:

The full name of the algorithm.

Return type:

str

is_scoring_scheme_relevant_when_incomplete_rankings(scoring_scheme: ScoringScheme) bool

Determine whether the provided scoring scheme is relevant when dealing with incomplete rankings.

Parameters:

scoring_scheme (ScoringScheme) – The scoring scheme to be evaluated.

Returns:

True if the scoring scheme is relevant for incomplete rankings, False otherwise.

Return type:

bool

exception corankco.algorithms.median_ranking.ScoringSchemeNotHandledException