crispyn.weighting_methods ========================= .. py:module:: crispyn.weighting_methods Classes ------- .. autoapisummary:: crispyn.weighting_methods.AHP_WEIGHTING Functions --------- .. autoapisummary:: crispyn.weighting_methods.equal_weighting crispyn.weighting_methods.entropy_weighting crispyn.weighting_methods.std_weighting crispyn.weighting_methods.critic_weighting crispyn.weighting_methods.gini_weighting crispyn.weighting_methods.merec_weighting crispyn.weighting_methods.stat_var_weighting crispyn.weighting_methods.cilos_weighting crispyn.weighting_methods.idocriw_weighting crispyn.weighting_methods.angle_weighting crispyn.weighting_methods.coeff_var_weighting crispyn.weighting_methods.swara_weighting crispyn.weighting_methods.lbwa_weighting crispyn.weighting_methods.sapevo_weighting Module Contents --------------- .. py:function:: equal_weighting(matrix) Calculate criteria weights using objective Equal weighting method. Parameters ----------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns -------- ndarray Vector of criteria weights. Examples ---------- >>> weights = equal_weighting(matrix) .. py:function:: entropy_weighting(matrix) Calculate criteria weights using objective Entropy weighting method. Parameters ----------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns -------- ndarray Vector of criteria weights. Examples ---------- >>> weights = entropy_weighting(matrix) .. py:function:: std_weighting(matrix) Calculate criteria weights using objective Standard deviation weighting method. Parameters ----------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns -------- ndarray Vector of criteria weights. Examples ---------- >>> weights = std_weighting(matrix) .. py:function:: critic_weighting(matrix) Calculate criteria weights using objective CRITIC weighting method. Parameters ----------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns -------- ndarray Vector of criteria weights. Examples ---------- >>> weights = critic_weighting(matrix) .. py:function:: gini_weighting(matrix) Calculate criteria weights using objective Gini coefficient-based weighting method. Parameters ---------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns -------- ndarray Vector of criteria weights. Examples --------- >>> weights = gini_weighting(matrix) .. py:function:: merec_weighting(matrix, types) Calculate criteria weights using objective MEREC weighting method. Parameters ----------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. types : ndarray Vector with criteria types. Returns -------- ndarray Vector of criteria weights. Examples --------- >>> weights = merec_weighting(matrix, types) .. py:function:: stat_var_weighting(matrix) Calculate criteria weights using objective Statistical variance weighting method. Parameters ---------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns ------- ndarray Vector of criteria weights. Examples --------- >>> weights = stat_var_weighting(matrix) .. py:function:: cilos_weighting(matrix, types) Calculate criteria weights using objective CILOS weighting method. Parameters ---------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. types : ndarray Vector with criteria types. Returns ------- ndarray Vector of criteria weights. Examples >>> weights = cilos_weighting(matrix, types) .. py:function:: idocriw_weighting(matrix, types) Calculate criteria weights using objective IDOCRIW weighting method. Parameters ---------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. types : ndarray Vector with criteria types. Returns ------- ndarray Vector of criteria weights. Examples --------- >>> weights = idocriw_weighting(matrix, types) .. py:function:: angle_weighting(matrix, types) Calculate criteria weights using objective Angle weighting method. Parameters ---------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. types : ndarray Vector with criteria types. Returns ------- ndarray Vector of criteria weights. Examples --------- >>> weights = angle_weighting(matrix, types) .. py:function:: coeff_var_weighting(matrix) Calculate criteria weights using objective Coefficient of variation weighting method. Parameters ---------- matrix : ndarray Decision matrix with performance values of m alternatives and n criteria. Returns ------- ndarray Vector of criteria weights. Examples --------- >>> weights = coeff_var_weighting(matrix) .. py:class:: AHP_WEIGHTING .. py:method:: __call__(X, compute_priority_vector_method=None) .. py:method:: _check_consistency(X) Consistency Check on the Pairwise Comparison Matrix of the Criteria or alternatives Parameters ----------- X : ndarray 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) .. py:method:: _eigenvector(X) Compute the Priority Vector of Criteria (weights) or alternatives using Eigenvector method Parameters ----------- X : ndarray 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) .. py:method:: _normalized_column_sum(X) Compute the Priority Vector of Criteria (weights) or alternatives using The normalized column sum method Parameters ----------- X : ndarray 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) .. py:method:: _geometric_mean(X) Compute the Priority Vector of Criteria (weights) or alternatives using The geometric mean method Parameters ----------- X : ndarray 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) .. py:method:: _ahp_weighting(self, X, compute_priority_vector_method) :staticmethod: Calculate criteria weights using subjective AHP weighting method based on provided pairwise criteria comparison matrix Parameters ------------ X : ndarray pairwise criteria comparison matrix compute_priority_vector_method : function 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) .. py:function:: swara_weighting(criteria_indexes, s) Calculation of criteria weights using SWARA subjective weighting method Parameters ------------- criteria_indexes : ndarray 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) s : ndarray 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) .. py:function:: lbwa_weighting(criteria_indexes, criteria_values_I) Calculation of criteria weights using subjective LBWA weighting method. Parameters ------------- criteria_indexes : list 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_I : list 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) .. py:function:: sapevo_weighting(criteria_matrix) Calculate criteria weights using SAPEVO subjective weighting method Parameters ------------ criteria_matrix : ndarray 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)