# skcriteria.preprocessing.push_negatives module¶

Functionalities for remove negatives from criteria.

In addition to the main functionality, an MCDA agnostic function is offered to push negatives values on an array along an arbitrary axis.

skcriteria.preprocessing.push_negatives.push_negatives(arr, axis)[source]

Increment the array until all the valuer are sean >= 0.

If an array has negative values this function increment the values proportionally to made all the array positive along an axis.

$\begin{split}\overline{X}_{ij} = \begin{cases} X_{ij} + min_{X_{ij}} & \text{if } X_{ij} < 0\\ X_{ij} & \text{otherwise} \end{cases}\end{split}$
Parameters
• arr (numpy.ndarray like.) – A array with values

• axis (int optional) – Axis along which to operate. By default, flattened input is used.

Returns

array with all values >= 0.

Return type

numpy.ndarray

Examples

>>> from skcriteria.preprocess import push_negatives
>>> mtx = [[1, 2], [3, 4]]
>>> mtx_lt0 = [[-1, 2], [3, 4]] # has a negative value

>>> push_negatives(mtx) # array without negatives don't be affected
array([[1, 2],
[3, 4]])

# all the array is incremented by 1 to eliminate the negative
>>> push_negatives(mtx_lt0)
array([[0, 3],
[4, 5]])

# by column only the first one (with the negative value) is affected
>>> push_negatives(mtx_lt0, axis=0)
array([[0, 2],
[4, 4]])
# by row only the first row (with the negative value) is affected
>>> push_negatives(mtx_lt0, axis=1)
array([[0, 3],
[3, 4]])

class skcriteria.preprocessing.push_negatives.PushNegatives(target)[source]

Increment the matrix/weights until all the valuer are sean >= 0.

If the matrix/weights has negative values this function increment the values proportionally to made all the matrix/weights positive along an axis.

$\begin{split}\overline{X}_{ij} = \begin{cases} X_{ij} + min_{X_{ij}} & \text{if } X_{ij} < 0\\ X_{ij} & \text{otherwise} \end{cases}\end{split}$