skcriteria.preprocessing.invert_objectives module

Implementation of functionalities for convert minimization criteria into maximization ones.

class skcriteria.preprocessing.invert_objectives.SKCObjectivesInverterABC[source]

Bases: SKCTransformerABC

Abstract class capable of invert objectives.

This abstract class require to redefine _invert, instead of _transform_data.

class skcriteria.preprocessing.invert_objectives.NegateMinimize[source]

Bases: SKCObjectivesInverterABC

Transform all minimization criteria into maximization ones.

The transformations are made by calculating the inverse value of the minimization criteria. \(\min{C} \equiv \max{-{C}}\).

class skcriteria.preprocessing.invert_objectives.InvertMinimize[source]

Bases: SKCObjectivesInverterABC

Transform all minimization criteria into maximization ones.

The transformations are made by calculating the inverse value of the minimization criteria. \(\min{C} \equiv \max{\frac{1}{C}}\)

Notes

All the dtypes of the decision matrix are preserved except the inverted ones thar are converted to numpy.float64.

class skcriteria.preprocessing.invert_objectives.MinimizeToMaximize(*args, **kwargs)[source]

Bases: InvertMinimize

Transform all minimization criteria into maximization ones.

The transformations are made by calculating the inverse value of the minimization criteria. \(\min{C} \equiv \max{\frac{1}{C}}\)

Deprecated since version 0.7: Use skcriteria.preprocessing.invert_objectives.InvertMinimize instead

Notes

All the dtypes of the decision matrix are preserved except the inverted ones thar are converted to numpy.float64.

class skcriteria.preprocessing.invert_objectives.MinMaxInverter(constant_criteria_kws=None)[source]

Bases: SKCObjectivesInverterABC

Normalize and invert minimization criteria using min-max scaling.

This class implements a dual-purpose transformation that simultaneously normalizes all criteria to the [0,1] range and inverts minimization criteria to maximization criteria. This is particularly useful for MCDA methods that require all criteria to have the same optimization direction and comparable scales.

The transformation preserves the relative order of alternatives while ensuring mathematical consistency across different criterion types and eliminates scale differences between criteria.

For minimization criteria, values are inverted by normalizing with:

(x - max) / (min - max)

which converts the minimization problem into a maximization one.

For maximization criteria, values are normalized with:

(x - min) / (max - min)

where the original maximum value becomes 1 (best) and the original minimum value becomes 0 (worst).

After transformation, all criteria become maximization criteria with values in the [0,1] range, where higher values are always better.

Parameters:

constant_criteria_kws (dict, optional) – Keyword arguments passed to the DecisionMatrix.constant_criteria() method to identify constant criteria. Default is None, which uses default detection parameters.

Notes

  • This transformation is idempotent for already normalized data with the same min-max bounds.

  • Constant criteria (where all alternatives have the same value) will result in NaN values after transformation due to division by zero in the normalization formula. In such cases, the constant criteria will be transformed to 0.

  • The transformation maintains the preference order within each criterion: better alternatives before transformation remain better after transformation.

property constant_criteria_kws

Get the constant criteria keyword arguments.

transform(dm)[source]

Perform transformation on dm.

Parameters:
  • dm (skcriteria.data.DecisionMatrix)

  • transform. (The decision matrix to)

Returns:

Transformed decision matrix.

Return type:

skcriteria.data.DecisionMatrix

class skcriteria.preprocessing.invert_objectives.BenefitCostInverter[source]

Bases: SKCObjectivesInverterABC

Inverts using ratios based on criterion type.

The matrix transformation is given by:

\[\]
For each criterion j, the normalized value is calculated as:
if j is a benefit criteria:

n_{ij} = frac{x_{ij}}{max_i x_{ij}}

if j is a cost criteria:

n_{ij} = frac{min_i x_{ij}}{x_{ij}}

Raises:

ValueError: – If the decision matrix contains negative values.