Methods
Validator
- class pyfdm.methods.validator.Validator[source]
Bases:
object
- static fuzzy_validation(matrix, weights, types=None, crisp_required=False)[source]
Runs all validations for the fuzzy TFN 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, default=None) – Types of criteria, 1 profit, -1 cost
crisp_required (bool, default=False) – Flag representing the need to obtain crisp criteria weights as input data
- Returns:
ValueError if one of validations do not pass
- 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_tfn_matrix(matrix)[source]
Checks if TFN matrix is defined properly, all elements should have length of 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 3
- 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, crisp_required=False)[source]
For crisp weights checks if sum of weights equals 1 For fuzzy weights checks if given as Triangular Fuzzy Numbers
- Parameters:
weights (ndarray) – Vector of weights in a crisp form or as a TFNs
crisp_required (bool, default=False) – Flag representing the need to obtain crisp criteria weights as input data
- Returns:
ValueError if sum of weights is different than 1 or not in TFN form
- Return type:
raises