Methods

Validator

class pyifdm.methods.validator.Validator[source]

Bases: object

static ifs_validation(matrix, weights, types, mixed_types=False)[source]

Runs all validations for the fuzzy IFS extension

Parameters:
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Vector of weights in a crisp form

  • types (ndarray) – Types of criteria, 1 profit, -1 cost

  • mixed_types (boolean, default=False) – Flag to determine if types array must be mixed

Returns:

ValueError if one of validations do not pass

Return type:

raises

static validate_ifs_matrix(matrix)[source]

Checks if IFS matrix is defined properly, all elements should have length of 2 or 3

Parameters:

matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

Returns:

ValueError if matrix elements has different length than 2 or 3

Return type:

raises

static validate_input(matrix, weights, types)[source]

Checks if number of criteria, number of weights, and number of types are the same

Parameters:
  • matrix (ndarray) – Decision matrix / alternatives data. Alternatives are in rows and Criteria are in columns.

  • weights (ndarray) – Vector of weights in a crisp form

  • types (ndarray) – Types of criteria, 1 profit, -1 cost

Returns:

ValueError if shapes of matrix, weights and types are not the same

Return type:

raises

static validate_types(types)[source]

Checks if all criteria types are same type

Parameters:

types (ndarray) – Types of criteria, 1 profit, -1 cost

Returns:

ValueError if criteria types are the same

Return type:

raises

static validate_weights(weights)[source]

For crisp weights checks if sum of weights equals 1 For fuzzy weights checks if given as IFS

Parameters:
  • weights (ndarray) – Vector of weights in a crisp form or as a IFS array

  • crisp_weights (bool) – Flag to check if only crisp weights are acceptable

Returns:

ValueError if sum of weights is different than 1 or not in IFS form

Return type:

raises