crispyn.weighting_methods

Classes

AHP_WEIGHTING

Functions

equal_weighting(matrix)

Calculate criteria weights using objective Equal weighting method.

entropy_weighting(matrix)

Calculate criteria weights using objective Entropy weighting method.

std_weighting(matrix)

Calculate criteria weights using objective Standard deviation weighting method.

critic_weighting(matrix)

Calculate criteria weights using objective CRITIC weighting method.

gini_weighting(matrix)

Calculate criteria weights using objective Gini coefficient-based weighting method.

merec_weighting(matrix, types)

Calculate criteria weights using objective MEREC weighting method.

stat_var_weighting(matrix)

Calculate criteria weights using objective Statistical variance weighting method.

cilos_weighting(matrix, types)

Calculate criteria weights using objective CILOS weighting method.

idocriw_weighting(matrix, types)

Calculate criteria weights using objective IDOCRIW weighting method.

angle_weighting(matrix, types)

Calculate criteria weights using objective Angle weighting method.

coeff_var_weighting(matrix)

Calculate criteria weights using objective Coefficient of variation weighting method.

swara_weighting(criteria_indexes, s)

Calculation of criteria weights using SWARA subjective weighting method

lbwa_weighting(criteria_indexes, criteria_values_I)

Calculation of criteria weights using subjective LBWA weighting method.

sapevo_weighting(criteria_matrix)

Calculate criteria weights using SAPEVO subjective weighting method

Module Contents

crispyn.weighting_methods.equal_weighting(matrix)

Calculate criteria weights using objective Equal weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = equal_weighting(matrix)
crispyn.weighting_methods.entropy_weighting(matrix)

Calculate criteria weights using objective Entropy weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = entropy_weighting(matrix)
crispyn.weighting_methods.std_weighting(matrix)

Calculate criteria weights using objective Standard deviation weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = std_weighting(matrix)
crispyn.weighting_methods.critic_weighting(matrix)

Calculate criteria weights using objective CRITIC weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = critic_weighting(matrix)
crispyn.weighting_methods.gini_weighting(matrix)

Calculate criteria weights using objective Gini coefficient-based weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = gini_weighting(matrix)
crispyn.weighting_methods.merec_weighting(matrix, types)

Calculate criteria weights using objective MEREC weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

typesndarray

Vector with criteria types.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = merec_weighting(matrix, types)
crispyn.weighting_methods.stat_var_weighting(matrix)

Calculate criteria weights using objective Statistical variance weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = stat_var_weighting(matrix)
crispyn.weighting_methods.cilos_weighting(matrix, types)

Calculate criteria weights using objective CILOS weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

typesndarray

Vector with criteria types.

Returns

ndarray

Vector of criteria weights.

Examples >>> weights = cilos_weighting(matrix, types)

crispyn.weighting_methods.idocriw_weighting(matrix, types)

Calculate criteria weights using objective IDOCRIW weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

typesndarray

Vector with criteria types.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = idocriw_weighting(matrix, types)
crispyn.weighting_methods.angle_weighting(matrix, types)

Calculate criteria weights using objective Angle weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

typesndarray

Vector with criteria types.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = angle_weighting(matrix, types)
crispyn.weighting_methods.coeff_var_weighting(matrix)

Calculate criteria weights using objective Coefficient of variation weighting method.

Parameters

matrixndarray

Decision matrix with performance values of m alternatives and n criteria.

Returns

ndarray

Vector of criteria weights.

Examples

>>> weights = coeff_var_weighting(matrix)
class crispyn.weighting_methods.AHP_WEIGHTING
__call__(X, compute_priority_vector_method=None)
_check_consistency(X)

Consistency Check on the Pairwise Comparison Matrix of the Criteria or alternatives

Parameters

Xndarray

matrix of pairwise comparisons

Examples

>>> PCcriteria = np.array([[1, 1, 5, 3], [1, 1, 5, 3], [1/5, 1/5, 1, 1/3], [1/3, 1/3, 3, 1]])
>>> ahp_weighting = AHP_WEIGHTING()
>>> ahp_weighting._check_consistency(PCcriteria)
_eigenvector(X)

Compute the Priority Vector of Criteria (weights) or alternatives using Eigenvector method

Parameters

Xndarray

matrix of pairwise comparisons

Returns

ndarray

Eigenvector

Examples

>>> PCM1 = np.array([[1, 5, 1, 1, 1/3, 3],
[1/5, 1, 1/3, 1/5, 1/7, 1],
[1, 3, 1, 1/3, 1/5, 1],
[1, 5, 3, 1, 1/3, 3],
[3, 7, 5, 3, 1, 7],
[1/3, 1, 1, 1/3, 1/7, 1]])
>>> ahp = AHP()
>>> S = ahp._eigenvector(PCM1)
_normalized_column_sum(X)

Compute the Priority Vector of Criteria (weights) or alternatives using The normalized column sum method

Parameters

Xndarray

matrix of pairwise comparisons

Returns

ndarray

Vector with weights calculated with The normalized column sum method

Examples

>>> PCM1 = np.array([[1, 5, 1, 1, 1/3, 3],
[1/5, 1, 1/3, 1/5, 1/7, 1],
[1, 3, 1, 1/3, 1/5, 1],
[1, 5, 3, 1, 1/3, 3],
[3, 7, 5, 3, 1, 7],
[1/3, 1, 1, 1/3, 1/7, 1]])
>>> ahp = AHP()
>>> S = ahp._normalized_column_sum(PCM1)
_geometric_mean(X)

Compute the Priority Vector of Criteria (weights) or alternatives using The geometric mean method

Parameters

Xndarray

matrix of pairwise comparisons

Returns

ndarray

Vector with weights calculated with The geometric mean method

Examples

>>> PCM1 = np.array([[1, 5, 1, 1, 1/3, 3],
[1/5, 1, 1/3, 1/5, 1/7, 1],
[1, 3, 1, 1/3, 1/5, 1],
[1, 5, 3, 1, 1/3, 3],
[3, 7, 5, 3, 1, 7],
[1/3, 1, 1, 1/3, 1/7, 1]])
>>> ahp = AHP()
>>> S = ahp._geometric_mean(PCM1)
static _ahp_weighting(self, X, compute_priority_vector_method)

Calculate criteria weights using subjective AHP weighting method based on provided pairwise criteria comparison matrix

Parameters

Xndarray

pairwise criteria comparison matrix

compute_priority_vector_methodfunction

selected function for calculation priority vector eigenvector, _normalized_column_sum, _geometric_mean

Returns

ndarray

Vector of criteria weights.

Examples

>>> PCcriteria = np.array([[1, 1, 5, 3], [1, 1, 5, 3],
    [1/5, 1/5, 1, 1/3], [1/3, 1/3, 3, 1]])
>>> ahp_weighting = AHP_WEIGHTING()
>>> weights = ahp_weighting(X = PCcriteria, compute_priority_vector_method=ahp_weighting._normalized_column_sum)
crispyn.weighting_methods.swara_weighting(criteria_indexes, s)

Calculation of criteria weights using SWARA subjective weighting method

Parameters

criteria_indexesndarray

Vector with indexes of n criteria in accordance with given decision problem from C1 to Cn ordered in descending order beginning from the most important criterion (Vector with sorted evaluation criteria in descending order, based on their expected significances)

sndarray

The s vector containing n-1 values of criteria comparison generated in following way: Make the respondent express how much criterion j-1 is more significant than criterion j in percentage in range [0, 1]

Returns

ndarray

Vector with criteria weights

Examples

>>> criteria_indexes = np.array([0, 1, 2, 3, 4, 5, 6])
>>> s = np.array([0, 0.35, 0.2, 0.3, 0, 0.4])
>>> swara_weights = swara_weighting(criteria_indexes, s)
crispyn.weighting_methods.lbwa_weighting(criteria_indexes, criteria_values_I)

Calculation of criteria weights using subjective LBWA weighting method.

Parameters

criteria_indexeslist including sublists

A list including sublists containing grouped and ordered indexes of criteria in a given decision problem from C1 to Cn according to their significance, beginning from the most significant

criteria_values_Ilist including sublists

A list including sublists containing influence values of criteria within each subset provided in order beginning from the most significant

Returns

ndarray

Vector of criteria weights

Examples

>>> criteria_indexes = [
        [1, 4, 6, 5, 0, 2],
        [7, 3]
    ]
>>>  criteria_values_I = [
        [0, 2, 3, 4, 4, 5],
        [1, 2]
    ]
>>> weights = lbwa_weighting(criteria_indexes, criteria_values_I)
>>> criteria_indexes = [
        [4, 7, 8, 0],
        [2, 3],
        [],
        [5],
        [],
        [],
        [1, 6]
    ]
>>> criteria_values_I = [
        [0, 1, 2, 4],
        [1, 2],
        [],
        [2],
        [],
        [],
        [1, 3]
    ]
>>> weights = lbwa_weighting(criteria_indexes, criteria_values_I)
crispyn.weighting_methods.sapevo_weighting(criteria_matrix)

Calculate criteria weights using SAPEVO subjective weighting method

Parameters

criteria_matrixndarray

Matrix with degrees of pairwise criteria comparison in scale from -3 to 3

Returns

ndarray:

Vector of criteria weights

Examples

>>> criteria_matrix = np.array([
    [0, 0, 3, 3, 1, 3, 2, 1, 2],
    [0, 0, 3, 3, 1, 3, 2, 1, 2],
    [-3, -3, 0, 0, -1, -2, -2, -1, -2],
    [-3, -3, 0, 0, -2, 2, -2, -2, -2],
    [-1, -1, 1, 2, 0, 2, 0, -1, 1],
    [-3, -3, 2, -2, -2, 0, -2, -1, -2],
    [-3, -2, 2, 2, 0, 2, 0, 3, 0],
    [-1, -1, 1, 2, 1, 1, -3, 0, -1],
    [-2, -2, 2, 2, -1, 2, 0, 1, 0],
])
>>> weights = sapevo_weighting(criteria_matrix)