skcriteria.validate module

This module core functionalities for validate the data used inside scikit criteria.

  • Constants that represent minimization and mazimization criteria.
  • Scikit-Criteria Criteria ndarray creation.
  • Scikit-Criteria Data validation.
skcriteria.validate.MIN = -1

Int: Minimization criteria

skcriteria.validate.MAX = 1

Int: Maximization criteria

exception skcriteria.validate.DataValidationError[source]

Bases: exceptions.ValueError

Raised when some part of the multicriteria data (alternative matrix, criteria array or weights array) are not compatible with another part.


Validate if the iterable only contains MIN (or any alias) and MAX (or any alias) values. And also always returns an ndarray representation of the iterable.


criteria : Array-like

Iterable containing all the values to be validated by the function.


numpy.ndarray :

Criteria array.


DataValidationError :

if some value of the criteria array are not MIN (-1) or MAX (1)

skcriteria.validate.validate_data(mtx, criteria, weights=None)[source]

Validate if the main components of the Data in scikit-criteria are compatible.

The function tests:

  • The matrix (mtx) must be 2-dimensional.
  • The criteria array must be a criteria array (criteriarr function).
  • The number of criteria must be the same number of columns in mtx.
  • The weight array must be None or an iterable with the same length of the criteria.

mtx : 2D array-like

2D alternative matrix, where every column (axis 0) are a criteria, and every row (axis 1) is an alternative.

criteria : Array-like

The sense of optimality of every criteria. Must has only MIN (-1) and MAX (1) values. Must has the same elements as columns has mtx

weights : array like or None

The importance of every criteria. Must has the same elements as columns has mtx or None.


mtx : numpy.ndarray

mtx representations as 2d numpy.ndarray.

criteria : numpy.ndarray

A criteria as numpy.ndarray.

weights : numpy.ndarray or None

A weights as numpy.ndarray or None (if weights is None).


DataValidationError :

If the data are incompatible.