Subpackages

Subpackages tools

pymcdm.methods.comet_tools

class pymcdm.methods.comet_tools.CompromiseExpert(evaluation_functions, vote_limit=None)

Bases: object

Create an object which will rate characteristic objects (CO) using compromise of several preferences. If the CO is better in most of the preferences, than it is bigger in the final MEJ.

Parameters:
  • evaluation_functions (list[Callable]) – List of functions which will evaluate preferences of the characteristic objets. If you want to use MCDA methods, please use lambda or partial to provide weights and types to them.

  • vote_limit (float) – Vote limit decides the limit for the voting. If number of votes CO_i > CO_j are bigger then vote_limit, then in the final MEJ matrix CO_i > CO_j, otherwise CO_i < CO_j.

Examples

>>> # Compromise solution for 3 different weights vectors
>>> import numpy as np
>>> from pymcdm.methods import COMET, TOPSIS
>>> from pymcdm.methods.comet_tools import CompromiseExpert
>>> cvalues = [
...         [0, 500, 1000],
...         [1, 5],
...         [1, 3, 10],
...         ]
>>> types = np.ones(3)
>>> topsis = TOPSIS()
>>> evaluation_function = [
...         lambda co: topsis(co, np.array([0.2, 0.3, 0.5]), types),
...         lambda co: topsis(co, np.array([0.3, 0.4, 0.3]), types),
...         lambda co: topsis(co, np.array([0.1, 0.5, 0.4]), types),
...         ]
>>> expert_function = CompromiseExpert(evaluation_function)
>>> comet = COMET(cvalues, expert_function)
class pymcdm.methods.comet_tools.ESPExpert(esps, bounds, distance_function=None, distance_aggregation=<function min>, cvalues_psi=None, full_domain_psi=False)

Bases: object

Create an object which will rate characteristic objects using Expected Solution Points (ESPs) provided by an expert to rate the characteristic objects.

Parameters:
  • esps (ndarray) – Numpy 2d matrix which defines chosed Expected Solution Points. Each row should define one ESP, number of the colums should be equal to the number of criteria.

  • bounds (ndarray) – Each row should contain min and max values for each criterion. Min and max should be different values!

  • distance_function (Callable or None) – Function which will be used to calculate the distance between two numpy array a and b. Signature of the function is d(a, b). If None, ESPExpert._euclides function is used and the Euclides distance is calculated between vectors.

  • distance_aggregation (Callable) – Function which is used to aggregate distances to several ESP for each characteristic object. Default is np.min().

  • cvalues_psi (float or None) – Float in range (0, 1). This value determines location of the additional ESP-guided characteristic values. E.g. criteria domain bounds are [0, 10] and ESP is 3. Then if we chose psi = 0.2 we will get following characteristic values for such criterion: [0, 2.4, 3, 4.4, 10] (the psi part of the distance between bound and ESP is substracted and added).

  • full_domain_psi (bool) – Determines if additional characteristic values will be generated using full domain (True) or distance between ESP and bounds (False). E.g. if full_domain_psi=True, criteria domain bounds are [0, 10] and ESP is 3. If we chose psi = 0.2 we will get following characteristic values for such criterion: [0, 1, 3, 5, 10] (the psi part of the distance between all domain is substracted and added).

Examples

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import pymcdm as pm
>>> # Define criteria bounds for the decision problem
>>> bounds = np.array([[0, 1]] * 2, dtype=float)
>>> # Define the Expected Solution Point (or Points) for this problem
>>> esps = np.array([[0.4, 0.4]])
>>> # Create the expert function using ESPExpert class
>>> expert = pm.methods.comet_tools.ESPExpert(esps,
...                                           bounds,
...                                           cvalues_psi=0.2)
>>> # Generate ESP-guided cvalues based on provided ESP and psi
>>> cvalues = expert.make_cvalues()
>>> # Create and identify COMET model
>>> comet = pm.methods.COMET(cvalues, expert)
>>> # Create a visualization of the characteriscic values,
>>> # ESP and preference function
>>> fig, ax = plt.subplots(figsize=(4, 3.5), dpi=200)
>>> ax, cax = pm.visuals.comet_2d_esp_plot(comet, esps, bounds)
>>> plt.tight_layout()
>>> plt.show()
__call__(co)

Evaluate characteristic objects using provided expected solution points.

Parameters:

co (np.array) – Characteristic objects which should be compared.

Returns:

  • sj (np.array) – SJ vector (see the COMET procedure for more info).

  • mej (np.array) – Identified MEJ matrix.

make_cvalues()

Generate the characteristic values array based on provided ESPs and psi values. Usually using COMET with such cvalues will provide better results, however it is not mandatory.

Returns:

cvalues – Characteristic values created based on ESPs and psi.

Return type:

np.array

class pymcdm.methods.comet_tools.FunctionExpert(expert_function)

Bases: object

Create an object which will rate characteristic objects using expert function.

Parameters:

expert_function (Callable) – Function with a signature (co_i, co_j) -> float. If co_i < co_j this function should return 0.0. If co_i == co_j this function should return 0.5. If co_i > co_j this function should return 1.0.

__call__(co)

Evaluate characteristic objects using provided expert function.

Parameters:

co (np.array) – Characteristic objects which should be compared.

Returns:

  • sj (np.array) – SJ vector (see the COMET procedure for more info).

  • mej (None) – Because of how this method works MEJ matrix is not generated.

class pymcdm.methods.comet_tools.ManualExpert(criteria_names, show_MEJ=False, tablefmt='simple_grid', filename='mej.csv', force_file_use=False)

Bases: object

Create object of the ManualExpert expert function which allows to manually identify Matrix of Expert Judgements (MEJ).

Parameters:
  • criteria_names (list[str]) – Criteria names which would be used during the procedure of the MEJ identification.

  • show_MEJ (bool) – If MEJ should be shown after each question answered. Default is False.

  • tablefmt (str) – tablefmt argument for the tablulate function. See tabulate documentation for more info. Default is ‘simple_grid’.

  • filename (str or None) – Path to the file in which identified save should be saved. If None, MEJ will be not saved. If file exists, MEJ will be loaded from this file. Default is ‘mej.csv’.

Examples

>>> import numpy as np
>>> from pymcdm.methods import COMET
>>> from pymcdm.methods.comet_tools import ManualExpert
>>> cvalues = [
...     [0, 500, 1000],
...     [1, 5]
...     ]
>>> expert_function = ManualExpert(
...     criteria_names=['Price [$]', 'Profit [grade]'],
...     show_MEJ=True
...     )
>>> # You will prompted to evaluate all CO
>>> comet = COMET(cvalues, expert_function)
__call__(characteristic_objects)

Evaluate characteristic objects by asking pairwise comparison questions.

Parameters:

characteristic_objects (np.array) – Characteristic objects which should be compared.

Returns:

  • sj (np.array) – SJ vector (see the COMET procedure for more info).

  • mej (np.array) – MEJ matrix created by comparisons (see the COMET procedure for more info).

class pymcdm.methods.comet_tools.MethodExpert(method, weights, types)

Bases: object

Create an object which will rate characteristic objects with any MCDA method.

Parameters:
  • method (MCDA_Method) – Any object of the MCDA method inherited from MCDA_Method.

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

Examples

>>> import numpy as np
>>> from pymcdm.methods import COMET, TOPSIS
>>> from pymcdm.methods.comet_tools import MethodExpert
>>> cvalues = [
...     [0, 500, 1000],
...     [1, 5]
...     ]
>>> weights = np.array([0.5, 0.5])
>>> types = np.array([-1, 1])
>>> expert_function = MethodExpert(TOPSIS(), weights, types)
>>> comet = COMET(cvalues, expert_function)
__call__(co)

Evaluate characteristic objects using provided MCDA method.

Parameters:

co (np.array) – Characteristic objects which should be compared.

Returns:

  • sj (np.array) – SJ vector (see the COMET procedure for more info).

  • mej (None) – Because of how this method works MEJ matrix is not generated.

class pymcdm.methods.comet_tools.StructuralCOMET(submodels, cvalues, criteria_names=None)

Bases: MCDA_method

Create Structural COMET model with defined structure [1].

Parameters:
  • submodels (list of Submodel objects) – List of the submodels which defines structure of the model. See example for more details.

  • cvalues (list of lists) – Characteristic values for criteria.

  • criteria_names (list or None) – Names of the criteria

References

Examples

See examples/comet_tool_examples.ipynb for example with explanation.

all_to_names(structure)
all_to_structures(structure)
class pymcdm.methods.comet_tools.Submodel(structure, cvalues, expert_function, name)

Bases: object

Create object of the COMET submodel. This class is mostly for internal use in the StructuralCOMET class or for creating StructuralCOMET object.

Parameters:
  • structure (tuple or int) – Structure of the submodel. Refer to the single criteria by names (str) or by indexes (int). If structure is more complex use defined names or nested structures. See example use of StructuralCOMET for more infomation.

  • cvalues (list or None) – Cvalues for output of this submodel. Pass None if it is a final model to be evaluated.

  • expert_function (Callable or None) – Expert function to evaluate characteristic objects in the submodel. See COMET documentation for more information. None is reserved for internal use in StructuralCOMET class.

  • name (str or None) – Name (alias) of the Submodel. If name is not None Submodel could be reffered by it in another Submodel in one StructuralCOMET model.

build(submodels)
class pymcdm.methods.comet_tools.TriadSupportExpert(criteria_names, show_MEJ=False, tablefmt='simple_grid', filename='mej.csv', force_file_use=False)

Bases: ManualExpert

Create object of the TriadSupportExpert expert function which allows to manually identify Matrix of Expert Judgements (MEJ), but with the support of the consistent triads.

Parameters:
  • criteria_names (list[str]) – Criteria names which would be used during the procedure of the MEJ identification.

  • show_MEJ (bool) – If MEJ should be shown after each question answered. Default is False.

  • tablefmt (str) – tablefmt argument for the tablulate function. See tabulate documentation for more info. Default is ‘simple_grid’.

  • filename (str or None) – Path to the file in which identified save should be saved. If None, MEJ will be not saved. If file exists, MEJ will be loaded from this file. Default is ‘mej.csv’.

Examples

>>> import numpy as np
>>> from pymcdm.methods import COMET
>>> from pymcdm.methods.comet_tools import TriadSupportExpert
>>> cvalues = [
...     [0, 500, 1000],
...     [1, 5]
...     ]
>>> expert_function = TriadSupportExpert(
...     criteria_names=['Price [$]', 'Profit [grade]'],
...     show_MEJ=True
...     )
>>> # You will prompted to evaluate some of the CO and
>>> # other CO will be completed using consistent triads.
>>> comet = COMET(cvalues, expert_function)
pymcdm.methods.comet_tools.get_local_weights(comet, alt, percent_step=0.01)
Calculates local weights for alternative alt for each criterion

using the algorithm presented in [1].

References

[1] Więckowski, J., Kizielewicz, B., Paradowski, B., Shekhovtsov, A., & Sałabun, W. (2023). Application of Multi-Criteria Decision Analysis to Identify Global and Local Importance Weights of Decision Criteria. International Journal of Information Technology & Decision Making, 22(06), 1867–1892. https://doi.org/10.1142/S0219622022500948 [2] Shekhovtsov, A. and Sałabun, W. (2024). Comparing Global and Local Weights in Multi-Criteria Decision-Making: A COMET-Based Approach. In Proceedings of the 16th International Conference on Agents and Artificial Intelligence - Volume 3: ICAART; ISBN 978-989-758-680-4; ISSN 2184-433X, SciTePress, pages 470-477. DOI: 10.5220/0012360700003636

pymcdm.methods.comet_tools.triads_consistency(comet_or_mej)

MEJ consistency coefficient based on inconsistence triads [2].

Parameters:

comet_or_mej (COMET or np.array) – Either identified COMET method object or MEJ matrix from it.

Return type:

Consistency coefficient value. See reference for details.

References

Examples

>>> import numpy as np
>>> from pymcdm.methods.comet_tools import triads_consistency
>>> mej = np.array([
...     [0.5, 0.0, 0.0, 1.0, 0.0, 1.0],
...     [1.0, 0.5, 0.0, 0.0, 0.0, 0.0],
...     [1.0, 1.0, 0.5, 0.0, 0.0, 0.0],
...     [0.0, 1.0, 1.0, 0.5, 0.0, 0.0],
...     [1.0, 1.0, 1.0, 1.0, 0.5, 0.0],
...     [0.0, 1.0, 1.0, 1.0, 1.0, 0.5]
... ])
>>> triads_consistency(mej)
0.75

Submodules

pymcdm.correlations module

pymcdm.correlations.draws(x, y)

Calculate drastic WS distance between the ranking vectors. Rankings should be presented as indices, i.e. for the ranking A2 > A1 > A3 the ranking vector should be [2, 1, 3].

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Drastic distance between two rankings vectors.

Return type:

float

pymcdm.correlations.goodman_kruskal_gamma(x, y)

Calculate Goodman’s and Kruskal’s Gamma correlation between two ranking vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.kendall_tau(x, y)

Calculate Kendall Tau correlation between two rankings vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.pearson(x, y)

Calculate Pearson correlation between two raw vectors.

Parameters:
  • x (ndarray) – First vector with raw values.

  • y (ndarray) – Second vector with raw values.

Returns:

Correlation between two vectors.

Return type:

float

pymcdm.correlations.r(x, y)

Calculate Pearson correlation between two raw vectors.

Parameters:
  • x (ndarray) – First vector with raw values.

  • y (ndarray) – Second vector with raw values.

Returns:

Correlation between two vectors.

Return type:

float

pymcdm.correlations.rank_similarity_coef(x, y)

Calculate Rank Similarity Coefficient (WS) between two ranking vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.rs(x, y)

Calculate Spearman correlation between two rankings vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.rw(x, y)

Calculate Weighted Spearman correlation between two rankings vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.spearman(x, y)

Calculate Spearman correlation between two rankings vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.weighted_spearman(x, y)

Calculate Weighted Spearman correlation between two rankings vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.ws(x, y)

Calculate Rank Similarity Coefficient (WS) between two ranking vectors.

Parameters:
  • x (ndarray) – First vector of ranks.

  • y (ndarray) – Second vector of ranks.

Returns:

Correlation between two rankings vectors.

Return type:

float

pymcdm.correlations.wsc(w0, w1)

Weights similarity coefficient for measuring the similarity between the criteria weights.

Parameters:
  • w0 (ndarray) – First vector of weights.

  • w1 (ndarray) – Second vector of weights.

Returns:

The similarity of the weights in range [0, 1], where 0 is different weights, and 1 is the same weights.

Return type:

float

pymcdm.correlations.wsc2(w0, w1)

Weights similarity coefficient for measuring the similarity between the criteria weights. This is symmetrical version, i.e. wsc2(a, b) == wsc2(b, a).

Parameters:
  • w0 (ndarray) – First vector of weights.

  • w1 (ndarray) – Second vector of weights.

Returns:

The similarity of the weights in range [0, 1], where 0 is different weights, and 1 is the same weights.

Return type:

float

pymcdm.helpers module

pymcdm.helpers.correlation_matrix(rankings, method, columns=False)

Creates a correlation matrix for given vectors from the numpy array.

Parameters:
  • rankings (ndarray) – Vectors for which the correlation matrix is to be calculated.

  • method (callable) – Function to calculate the correlation matrix.

  • columns (bool) – If the column value is set to true then the correlation matrix will be calculated for the columns. Otherwise the matrix will be calculated for the rows.

Returns:

Correlation between two rankings vectors.

Return type:

ndarray

pymcdm.helpers.leave_one_out_rr(method, matrix, weights, types, corr_function, ideal_corr_value=1, only_rr=True)

Function which implements the procedure similar to leave one out cross validation. This function calculates N rankings from N decision matrices created by removing one of N alternatives from original one. This function returns the array of rankings build in following way: [original_ranking, w/o A1, w/o A2, …, w/o AN, original_ranking].

This function will insert in the ranking value 0 instead of removed alternative position. E.g. original ranking is [1, 2, 3, 4], ranking without A1 will looks like [0, 1, 2, 3].

This function main purpose is to prepare data for rankings_flow visualization function.

Parameters:
  • method (MCDA_method) – MCDA method which should be used to calculate rankings.

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

  • weights (ndarray) – Criteria weights. Sum of the weights should be 1. (e.g. sum(weights) == 1)

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

  • corr_function (Callable) – Correlation function to calculate correlation value between rankings.

  • ideal_corr_value (float) – Correlation value for ideal ranking. Default is 1. Use it if correlation function you use has different value for two same rankings (e.g. 0).

  • only_rr (bool) – Include in returned collections only rankings in which rank reversal occurs. If rank reversal do not occured the list of two original rankings will be returned. Default is True.

Returns:

  • rankings (ndarray) – Matrix of rankings obtained when removing different alternatives. Instead of removed alternatives 0 is placed.

  • correlations (list) – List of correlation values calculated for rankings in rankings matrix.

  • labels (list) – Names of the created rankings. It will looks like [‘None’, ‘w/o A_1’, ‘w/o A_2’, … ‘None’], where ‘w/o A_i’ means that this ranking was build without alternative A_i.

Examples

>>> import numpy as np
>>> import pymcdm as pm
>>> matrix = np.array([
...     [1, 9, 3, 4, 2],
...     [3, 2, 1, 6, 1],
...     [4, 6, 3, 2, 1],
...     [1, 2, 3, 4, 7],
...     [3, 2, 4, 5, 1]
... ])
>>> topsis = pm.methods.TOPSIS()
>>> weights = np.ones(5)/5
>>> types = np.ones(5)
>>> rankings, cors, labels = leave_one_out_rr(
...         topsis,
...         matrix,
...         weights,
...         types,
...         pm.correlations.weighted_spearman,
...         only_rr=False)
>>> print(labels, cors, rankings)
pymcdm.helpers.normalize_matrix(matrix, method, criteria_types)

Normalize each column in matrix, using method`normalization function according to `criteria_types.

Parameters:
  • matrix (ndarray) – Decision matrix representation. The rows are considered as alternatives and the columns are considered as criteria.

  • method (Callable or Iterable[Callable]) – Function or Functions which should be used to normalize matrix columns. Functions should match signature foo(x, cost), where x is a vector which would be normalized and cost is a bool variable which says if x is a cost or profit criteria. In case of providing list or tuple of the functions, number of functions should be the same as number of criteria in matrix (columns) and same as the lenght of the criteria_types.

  • criteria_types (None or Iterable) – Describes criteria types. 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix. If None all criteria are considered as profit

Returns:

Normalized copy of the input matrix.

Return type:

ndarray

Raises:

ValueError – If criteria_types and matrix has different number of criteria.

pymcdm.helpers.rankdata(a, reverse=False)

Assign ranks to data in vector a.

Ranks begin at 1. Tied elements get average rank (see Examples below).

Ranking starts from smaller values, e.g. the smaller element get the first position. The reverse argument reverse posisions, e.g. the largest element get first position.

Parameters:
  • a (iterable) – The array of values to be ranked.

  • reverse (bool, optional) – If True, larger elements get first posisions in ranking. If False, smaller elements get first positions in ranking.

Returns:

An array of rank scores for the input data.

Return type:

ndarray

Examples

>>> from pymcdm.helpers import rankdata
>>> rankdata([0, 3, 2, 5])
array([1, 3, 2, 4])
>>> rankdata([0, 3, 2, 5], reverse=True)
array([4, 2, 3, 1])
>>> rankdata([0, 3, 2, 3])
array([1. , 3.5, 2. , 3.5])
>>> rankdata([0, 3, 2, 3], reverse=True)
array([4. , 1.5, 3. , 1.5])
pymcdm.helpers.rrankdata(a)

Alias to rankdata(a, reverse=True). See rankdata for details.

pymcdm.normalizations module

pymcdm.normalizations.enhanced_accuracy_normalization(x, cost=False)

Calculate the normalized vector using the enhanced accuracy method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.linear_normalization(x, cost=False)

Calculate the normalized vector using the linear method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.logarithmic_normalization(x, cost=False)

Calculate the normalized vector using the logarithmic method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.max_normalization(x, cost=False)

Calculate the normalized vector using the max method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.minmax_normalization(x, cost=False)

Calculate the normalized vector using the min-max method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.nonlinear_normalization(x, cost=False)

Calculate the normalized vector using the nonlinear method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.sum_normalization(x, cost=False)

Calculate the normalized vector using the sum method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.vector_normalization(x, cost=False)

Calculate the normalized vector using the vector method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.normalizations.zavadskas_turskis_normalization(x, cost=False)

Calculate the normalized vector using the Zavadskas-Turskis method.

Parameters:
  • x (ndarray) – One-dimensional numpy array of values to be normalized

  • cost (bool, optional) – Vector type. Default profit type.

Returns:

One-dimensional numpy array of normalized values.

Return type:

ndarray

pymcdm.weights module

pymcdm.weights.angle_weights(matrix, *args, **kwargs)

Calculate weights for given matrix using angle method.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.cilos_weights(matrix, types, *args, **kwargs)

Calculate weights for given matrix using CILOS method.

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

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.critic_weights(matrix, *args, **kwargs)

Calculate weights for given matrix using CRITIC method.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.entropy_weights(matrix, *args, **kwargs)

Calculate weights for given matrix using entropy method.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.equal_weights(matrix, *args, **kwargs)

Calculate equal weights for given matrix.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.gini_weights(matrix, *args, **kwargs)

Calculate weights for given matrix using gini method.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.idocriw_weights(matrix, types, *args, **kwargs)

Calculate weights for given matrix using IDOCRIW method.

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

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.merec_weights(matrix, types, *args, **kwargs)

Calculate weights for given matrix using MEREC method.

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

  • types (ndarray) – Array with definitions of criteria types: 1 if criteria is profit and -1 if criteria is cost for each criteria in matrix.

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.standard_deviation_weights(matrix, *args, **kwargs)

Calculate weights for given matrix using std method.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray

pymcdm.weights.variance_weights(matrix, *args, **kwargs)

Calculate weights for given matrix using std method.

Parameters:

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

Returns:

Vector of weights.

Return type:

ndarray