skcriteria.ranksrev.rank_transitivity_check module

Transitivity Checker for MCDM Robustness Evaluation.

This module evaluates the logical consistency and stability of Multi-Criteria Decision Making (MCDM) methods through transitivity analysis. It decomposes decision problems into pairwise comparisons and reconstructs global rankings to assess method robustness.

The module validates whether rankings satisfy the transitivity property (if A ≻ B and B ≻ C, then A ≻ C) and provides mechanisms to handle violations.

Key Features

  • Transitivity validation through pairwise decomposition

  • Ranking recomposition with cycle-breaking strategies

  • Comprehensive diagnostic reporting

class skcriteria.ranksrev.rank_transitivity_check.RankTransitivityChecker(dmaker, *, fallback=None, random_state=None, allow_missing_alternatives=False, cycle_removal_strategy='random', max_ranks=50, parallel_backend=None, n_jobs=None)[source]

Bases: SKCMethodABC

Robustness evaluator for Multi-Criteria Decision Making (MCDM) methods.

This class validates the logical consistency and stability of MCDM method rankings by analyzing transitivity properties through pairwise alternative comparisons. It identifies ranking inconsistencies and provides alternative ranking reconstructions when transitivity violations occur.

The evaluation process is the following:

  1. Pairwise Dominance Analysis: Evaluates all possible pairs of alternatives using the provided MCDM method to construct a directed dominance graph representing preference relationships.

  2. Transitivity Validation (Test Criterion 2): Detects cycles in the dominance graph that violate the transitivity property. A transitive ranking requires that if A > B and B > C, then A > C must hold.

  3. Ranking Stability Assessment (Test Criterion 3): Compares the original ranking with reconstructed rankings to evaluate consistency when the decision problem is decomposed and recomposed.

  4. Ranking Reconstruction: When transitivity violations exist, applies cycle-breaking strategies to generate alternative valid rankings through graph decomposition techniques.

Parameters:
  • dmaker (object) – Decision maker instance that must implement an evaluate(dm) method. This represents the MCDM method or pipeline to be evaluated for robustness.

  • fallback (object) – Optional fallback decision maker for tie-breaking in pairwise comparisons. Must also implement an evaluate(dm) method. If not provided, lexicographical tie breaking is used.

  • random_state (int, numpy.random.Generator, or None, default=None) – Controls randomization in cycle-breaking strategies and alternative ranking generation. Ensures reproducible results when set to a specific integer.

  • allow_missing_alternatives (bool, default=False) – Whether to allow rankings that don’t include all original alternatives (using a pipeline that implements a filter, for example can remove alternatives). When False, raises ValueError if any alternative is missing from results. When True, missing alternatives are assigned the worst ranking + 1.

  • cycle_removal_strategy (str or callable, default="random") – Strategy for breaking cycles in non-transitive dominance graphs. Available built-in strategies include cycle removal heuristics. Can also accept custom callable functions for specialized approaches.

  • max_ranks (int, default=50) – Maximum number of alternative rankings to generate when breaking cycles. Controls computational complexity by limiting the number of decompositions.

  • parallel_backend (str or None, default=None) – Backend for parallel computation of pairwise evaluations. Options include ‘threading’, ‘multiprocessing’, or None for sequential. Improves performance for large numbers of alternatives.

  • n_jobs (int or None, default=None) – Number of parallel jobs for pairwise evaluation. When None, uses all available processors. Set to 1 for sequential processing.

Raises:
  • TypeError – If dmaker doesn’t implement the required evaluate() method.

  • ValueError – If cycle_removal_strategy is not a valid strategy name or callable. If allow_missing_alternatives=False and alternatives are missing from results.

Examples

Basic usage with an MCDM method:

>>> from skcriteria.preprocessing import invert_objectives
>>> from skcriteria.agg import simple
>>>
>>> # Create a decision maker
>>> dm_method = simple.WeightedSum()
>>>
>>> # Initialize transitivity checker
>>> checker = RankTransitivityChecker(dm_method)
>>>
>>> # Evaluate a decision matrix
>>> result = checker.evaluate(dm=decision_matrix)
>>>
>>> # Check test results
>>> print(f"Test Criterion 2: {result.extra['test_criterion_2']}")
>>> print(f"Test Criterion 3: {result.extra['test_criterion_3']}")

Advanced configuration with custom parameters:

>>> checker = RankTransitivityChecker(
...     dmaker=dm_method,
...     random_state=42,
...     allow_missing_alternatives=True,
...     cycle_removal_strategy="random",
...     max_ranks=100,
...     parallel_backend="threading",
...     n_jobs=4
... )
property dmaker

The MCDA method, or pipeline to evaluate.

property fallback

The MCDA method, or pipeline to evaluate for tie breaking.

property random_state

Controls the random state to generate variations in the suboptimal alternatives.

property allow_missing_alternatives

Whether rankings are allowed that don’t contain all original alternatives.

property cycle_removal_strategy

The strategy function used for breaking transitivity cycles.

property max_ranks

Maximum number of rankings to be generated.

property parallel_backend

The parallel backend used to generate all the alternatives.

property n_jobs

The number of parallel jobs used in the pairwise evaluations.

evaluate(*, dm)[source]

Execute the complete transitivity test and ranking analysis.

This method performs a comprehensive transitivity analysis, including dominance graph construction, transitivity testing, and ranking recomposition. It provides multiple ranking perspectives when cycles are present and diagnostic information about the decision problem’s structure.

Parameters:

dm (DecisionMatrix) – The decision matrix to be evaluated, containing alternatives and criteria values for multi-criteria decision analysis.

Returns:

A comprehensive result object containing:

  • Multiple named rankings (original + recompositions)

  • Diagnostic information in the extra attribute:
    • test_criterion_2: Transitivity consistency test result

    • test_criterion_3: Ranking stability test result

    • pairwise_dominance_graph: The constructed dominance graph

    • transitivity_break: List of transitivity violations

    • transitivity_break_rate: Normalized violation rate

Return type:

RanksComparator