skcriteria.pipeline module

The Module implements utilities to build a composite decision-maker.

class skcriteria.pipeline.SKCPipeline(steps)[source]

Bases: skcriteria.core.methods.SKCMethodABC

Pipeline of transforms with a final decision-maker.

Sequentially apply a list of transforms and a final decisionmaker. Intermediate steps of the pipeline must be ‘transforms’, that is, they must implement transform method.

The final decision-maker only needs to implement evaluate.

The purpose of the pipeline is to assemble several steps that can be applied together while setting different parameters. A step’s estimator may be replaced entirely by setting the parameter with its name to another dmaker or a transformer removed by setting it to ‘passthrough’ or None.

Parameters

steps (list) – List of (name, transform) tuples (implementing evaluate/transform) that are chained, in the order in which they are chained, with the last object an decision-maker.

See also

skcriteria.pipeline.mkpipe

Convenience function for simplified pipeline construction.

property steps

List of steps of the pipeline.

property named_steps

Dictionary-like object, with the following attributes.

Read-only attribute to access any step parameter by user given name. Keys are step names and values are steps parameters.

evaluate(dm)[source]

Run the all the transformers and the decision maker.

Parameters

dm (skcriteria.data.DecisionMatrix) – Decision matrix on which the result will be calculated.

Returns

r – Whatever the last step (decision maker) returns from their evaluate method.

Return type

Result

transform(dm)[source]

Run the all the transformers.

Parameters

dm (skcriteria.data.DecisionMatrix) – Decision matrix on which the transformations will be applied.

Returns

dm – Transformed decision matrix.

Return type

skcriteria.data.DecisionMatrix

skcriteria.pipeline.mkpipe(*steps)[source]

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

This is a shorthand for the SKCPipeline 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-learn SKCPipeline object.

Return type

SKCPipeline