scoring scheme

Module to manage Scoring Schemes. The scoring schemes are two penalty vectors of 6 real values each. The details can be found in the docstring of the ScoringScheme class

exception corankco.scoringscheme.ForbiddenAssociationPenaltiesScoringScheme(message='The first value of the first List must be 0. The second value of the first List must be > 0The fourth value of the first List must be <= the fifth value of the second ListThe first and second values of the second List must be equal. The fourth and the fifth values of the second List must be equalThe third value of the second List must be > 0For instance, [[0., 1., 1., 0., 0., 0.], [1., 1., 0., 1., 1., 0.]]')

Customized exception when the ScoringScheme is invalid because wring association of penalties.

exception corankco.scoringscheme.InvalidScoringScheme(message='Scoring scheme must be 2 Lists. Each list must be a list of 6 real >= 0 values. For instance, [[0., 1., 1., 0., 0., 0.], [1., 1., 0., 1., 1., 0.]]')

Customized exception when the ScoringScheme is invalid because of the structure.

exception corankco.scoringscheme.NonRealPositiveValuesScoringScheme(message='Each list must be a list of 6 real >= 0 values. For instance, [[0., 1., 1., 0., 0., 0.], [1., 1., 0., 1., 1., 0.]]')

Customized exception when the ScoringScheme is invalid because of a value found, not real positive.

class corankco.scoringscheme.ScoringScheme(penalties: List[List[float]])

The ScoringScheme class represents a scoring scheme for comparing rankings.

Parameters:

penalties – A list of 2 penalty vectors i.e. two lists of size 6. Let B be the first penalty vector and T be the second one, c be a consensus ranking (complete) and r be a ranking. B: costs to pay for each elements x,y such that x < y in the consensus, more precisely: B[0] if x < y in r, B[1] if x > y in r, B[2] if x is tied with y in r, B[3] if x is ranked and y is not, B[4] if y is ranked and x is not, B[5] if x and y are non-ranked. T: costs to pay for each elements x,y such that x is tied with y in the consensus, more precisely: T[0] if x < y in r, T[1] if x > y in r, T[2] if x is tied with y in r, T[3] if x is ranked and y is not, T[4] if y is ranked and x is not, T[5] if x and y are non-ranked

Raises:
  • InvalidScoringScheme – If penalties is not of a correct format.

  • NonRealPositiveValuesScoringScheme – If one penalty is not a real value>= 0.

  • ForbiddenAssociationPenaltiesScoringScheme – If one of the following is not respected: - first value of first list must be 0 - second value of the first List must be > 0 - fourth value of the first List must be <= the fifth value of the second List - third value of second list must be > 0 - first and second values of the second List must be equal - fourth and fifth values of the second List must be equal

property b_vector: List[float]

Returns the List of 6 floats that corresponds to vector B according to Andrieu et al., IJAR 2022 :return: vector B of the Scoring Scheme as a List of 6 floats. :rtype: List[float]

description() str

Returns a string that gives details on the ScoringScheme :return: a string that gives details on the ScoringScheme :rtype: str

static get_extended_measure_scoring_scheme()

Get the ScoringScheme defined in [] :return: The ScoringScheme

static get_induced_measure_scoring_scheme()

Get the induced mesure scoring scheme defined in “Bryan Brancotte, Agrégation de classements avec égalités : algorithmes, guides à l’utilisateur et applications aux données biologiques. University of Paris-Sud, Orsay, France, 2015”. This measure is a fusion between the measure to handle incomplete rankings defined in: C. Dwork, R. Kumar, M. Naor, and D. Sivakumar. 2001. Rank aggregation methods for the Web. In Proceedings of the 10th international conference on World Wide Web (WWW ‘01), and the distance to handle ties proposed by R. Fagin, R. Kumar, M. Mahdian, D. Sivakumar, and Erik Vee. 2004. Comparing and aggregating rankings with ties. In Proceedings of the twenty-third ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems (PODS ‘04). :return: The ScoringScheme [[0., 1., 1., 0., 0., 0.], [1., 1., 0., 0., 0., 0.]]

static get_induced_measure_scoring_scheme_p(p_cost: float)

Get the ScoringScheme that imitates the unification process, that is the non-ranked elements can be virtually considered as tied at the last position or the ranking :param p_cost: the cost to create / break ties :return: The ScoringScheme [[0., 1., p, 0., 1., p], [p, p, 0., p, p, 0.]]

get_nickname() str

Get a nickname of the scoring scheme.

Returns:

A string representing a nickname of the scoring scheme.

static get_pseudodistance_scoring_scheme() ScoringScheme

Get the pseudo-distance defined in: Brancotte, Bryan & Rance, Bastien & Denise, Alain & Cohen-Boulakia, Sarah. (2014). ConQuR-Bio: Consensus Ranking with Query Reformulation for Biological Data. 10.1007/978-3-319-08590-6_13. .

Returns:

The ScoringScheme [[0., 1., 1., 0., 1., 0.], [1., 1., 0., 1., 1., 0.]]

static get_pseudodistance_scoring_scheme_p(p_cost: float)

Get the pseudo-distance scoring scheme defined in: Brancotte, Bryan & Rance, Bastien & Denise, Alain & Cohen-Boulakia, Sarah. (2014). ConQuR-Bio: Consensus Ranking with Query Reformulation for Biological Data. 10.1007/978-3-319-08590-6_13 with reap parameter p = cost of creating / breaking ties :param p_cost: the cost to create / break ties :return: The ScoringScheme [[0., 1., 1., 0., 1., 0.], [1., 1., 0., 1., 1., 0.]]

static get_unifying_scoring_scheme()

Get the ScoringScheme that imitates the unification process, that is the non-ranked elements can be virtually considered as tied at the last position or the ranking :return: The ScoringScheme [[0., 1., 1., 0., 1., 1.], [1., 1., 0., 1., 1., 0.]]

static get_unifying_scoring_scheme_p(p_cost: float)

Get the ScoringScheme that imitates the unification process, that is the non-ranked elements can be virtually considered as tied at the last position or the ranking :param p_cost: the cost to create / break ties :return: The ScoringScheme [[0., 1., p, 0., 1., p], [p, p, 0., p, p, 0.]]

is_equivalent_to(other) bool

Check if the current scoring scheme is equivalent to the given scoring scheme.

Parameters:

other – A ScoringScheme object.

Returns:

True if the scoring schemes are equivalent, False otherwise.

is_equivalent_to_on_complete_rankings_only(other) bool

Check if the current scoring scheme is equivalent to the given scoring scheme on complete rankings

Parameters:

other – A ScoringScheme object.

Returns:

True if the scoring schemes are equivalent, False otherwise.

property penalty_vectors: List[List[float]]

Returns the List of two penalty vectors (each one is a List of 6 floats) of the ScoringScheme

Returns:

List of two penalty vectors (each one is a List of 6 floats) of the ScoringScheme. For instance, [[0., 1., 0.5, 0., 1., 0.], [0.5, 0.5, 0., 0.5, 0.5, 0.]]

Return type:

List[List[float]]

property t_vector: List[float]

Returns the List of 6 floats that corresponds to vector T according to Andrieu et al., IJAR 2022 :return: penalty vector T of the Scoring Scheme as a List of 6 floats. :rtype: List[float]