skcriteria.preprocessing.increment
module¶
Functionalities to add an value when an array has a zero.
In addition to the main functionality, an MCDA agnostic function is offered to add value to zero on an array along an arbitrary axis.
- skcriteria.preprocessing.increment.add_value_to_zero(arr, value, axis=None)[source]¶
Add value if the axis has a value 0.
\[\overline{X}_{ij} = X_{ij} + value\]- Parameters
arr (
numpy.ndarray
like.) – A array with valuesvalue (number) – Number to add if the axis has a 0.
axis (
int
optional) – Axis along which to operate. By default, flattened input is used.
- Returns
array with all values >= value.
- Return type
numpy.ndarray
Examples
>>> from skcriteria import add_to_zero # no zero >>> mtx = [[1, 2], [3, 4]] >>> add_to_zero(mtx, value=0.5) array([[1, 2], [3, 4]]) # with zero >>> mtx = [[0, 1], [2,3]] >>> add_to_zero(mtx, value=0.5) array([[ 0.5, 1.5], [ 2.5, 3.5]])
- class skcriteria.preprocessing.increment.AddValueToZero(target, value=1.0)[source]¶
Bases:
SKCMatrixAndWeightTransformerABC
Add value if the matrix/weight whe has a value 0.
\[\overline{X}_{ij} = X_{ij} + value\]- property value¶
Value to add to the matrix/weight when a zero is found.