# skcriteria.preprocessing.invert_objectives module¶

Implementation of functionalities for inverting minimization criteria and converting them into maximization ones.

In addition to the main functionality, an agnostic MCDA function is offered that inverts columns of a matrix based on a mask.

class skcriteria.preprocessing.invert_objectives.MinimizeToMaximize[source]

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.

Inverts all the columns selected by the mask.

Parameters
• matrix (numpy.ndarray like.) – 2D array.

• mask (numpy.ndarray like.) – Boolean array like with the same elements as columns has the matrix.

Returns

New matrix with the selected columns inverted. The result matrix dtype float.

Return type

numpy.ndarray

Examples

>>> from skcriteria import invert
>>> invert([
...     [1, 2, 3],
...     [4, 5, 6]
... ],
... [True, False, True])
array([[1.        , 2.        , 0.33333333],
[0.25      , 5.        , 0.16666667]])

>>> invert([
...     [1, 2, 3],
...     [4, 5, 6]
... ],
... [False, True, False])
array([[1.        , 2.        , 0.33333333],
[0.25      , 5.        , 0.16666667]])
array([[1. , 0.5, 3. ],
[4. , 0.2, 6. ]]