skcriteria.pipelines.combinatorial module

The Module implements utilities to build a combinatorial pipeline.

class skcriteria.pipelines.combinatorial.SKCCombinatorialPipeline(steps)[source]

Bases: SKCMethodABC

Model that encapsulates a pipeline of MCDA methods with alternatives.

This class allows you to define a sequential pipeline of data transformation and aggregation steps, where some steps may have multiple alternative implementations. The CombinatorialPipeline will generate all possible pipelines by combining these alternatives and evaluate them.

Parameters:

steps (list of (str, method or list of methods)) –

List of (name, transform) tuples (implementing fit/transform) that are chained, in the order in which they are chained. Steps can be a single method or a list of alternative methods.

# simple pipeline
steps = [
    ("inverter", invert_objectives.InvertObjectives()),
    ("scaler", scalers.SumScaler(target="matrix")),
    ("agg", simple.WeightedSum())
]

# pipeline with alternatives in the scaler step
steps = [
    ("inverter", invert_objectives.InvertObjectives()),
    (
        "scaler",
        [
            scalers.SumScaler(target="matrix"),
            scalers.VectorScaler(target="matrix"),
        ],
    ),
    ("agg", simple.WeightedSum()),
]

property steps

The raw steps provided during initialization.

property named_steps

The raw steps provided during initialization as a dict-like.

property pipelines

List of all generated pipelines.

property named_pipelines

A dict-like of all generated pipelines.

transform(dm)[source]

Transform the data, without applying the final evaluator.

This method applies the transformation steps (such as inverters and scalers) of each individual pipeline to the input decision matrix. It does not execute the final aggregation step (the evaluator), behaving analogously to the transform method of a standard SKCPipeline.

Since multiple pipelines are generated, this method does not return a single transformed decision matrix, but rather a dictionary-like containing all transformed matrices, each associated with the unique name of the pipeline that generated it.

Parameters:

dm (skcriteria.core.DecisionMatrix) – The decision matrix to transform.

Returns:

A dictionary mapping the name of each pipeline (str) to its corresponding transformed skcriteria.core.DecisionMatrix.

Return type:

dict-like

See also

SKCCombinatorialPipeline.evaluate

Evaluate all pipelines and compare their final rankings.

SKCCombinatorialPipeline.pipelines

Access the list of individual generated pipelines.

SKCPipeline.transform

Transforms the data using a single pipeline.

evaluate(dm)[source]

Evaluates all generated pipelines with the given DecisionMatrix.

Parameters:

dm (skcriteria.core.DecisionMatrix) – The decision matrix to evaluate.

Returns:

A comparator object containing the ranks of all alternatives for each generated pipeline.

Return type:

skcriteria.cmp.RanksComparator

skcriteria.pipelines.combinatorial.mkcombinatorial(*steps)[source]

Construct a CombinatorialPipeline from the given transformers and decision-maker.

This is a shorthand for the CombinatorialPipeline constructor; it does not require, and does not permit, naming the estimators. Instead, their names will be set to the lowercase of their types automatically.

Parameters:

*steps (list of transformers and decision-maker object) – List of the scikit-criteria transformers and decision-maker that are chained together.

Returns:

p – Returns a scikit-criteria CombinatorialPipeline object.

Return type:

CombinatorialPipeline