pyFDM library

Subpackages

Correlations module

pyfdm.correlations.pearson_coef(x, y)[source]

Calculate Pearson correlation between two vectors

Parameters:
  • x (ndarray) – Array with values

  • y (ndarray) – Array with values

Returns:

Correlation between two vectors

Return type:

float

pyfdm.correlations.spearman_coef(x, y)[source]

Calculate Spearman correlation between two vectors

Parameters:
  • x (ndarray) – Array with values

  • y (ndarray) – Array with values

Returns:

Correlation between two vectors

Return type:

float

pyfdm.correlations.weighted_spearman_coef(x, y)[source]

Calculate Weighted Spearman correlation between two rankings

Parameters:
  • x (ndarray) – Array with ranking

  • y (ndarray) – Array with ranking

Returns:

Correlation between two vectors

Return type:

float

pyfdm.correlations.ws_rank_similarity_coef(x, y)[source]

Calculate WS Rank Similarity Coefficient between two rankings

Parameters:
  • x (ndarray) – Array with ranking

  • y (ndarray) – Array with ranking

Returns:

Correlation between two rankings

Return type:

float

Helpers module

pyfdm.helpers.generate_fuzzy_matrix(m, n, lower=0.0, upper=1.0)[source]

Generates random Triangular Fuzzy Numbers with m alternatives and n criteria, each TFN is places between lower and upper bound

Parameters:
  • m (int) – Number of alternatives

  • n (int) – Number of criteria

  • lower (float, default=0.0) – Minimum value of left bound

  • upper (float, default=1.0) – Maximum value of right bound

Returns:

Matrix with random TFN within given bounds

Return type:

ndarray

pyfdm.helpers.normalize_weights(weights)[source]

Normalize fuzzy criteria weights

Parameters:

weights (ndarray) – Vector of weights in a crisp form or as a TFNs

Returns:

Normalized fuzzy criteria weights

Return type:

ndarray

pyfdm.helpers.rank(x, descending=True)[source]

Calculates ranking of given values with the given direction, default descending order

Parameters:
  • x (ndarray) – Array with values

  • descending (boolean, default=True) – Switch to change ranking order

Returns:

Ranking with given order

Return type:

ndarray

Weights module

pyfdm.weights.equal_weights(matrix)[source]

Calculates the objective weights for Triangular Fuzzy Matrix, each weight will have the same value

Parameters:

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

Returns:

Array of equal weights

Return type:

ndarray

pyfdm.weights.shannon_entropy_weights(matrix)[source]

Calculates the objective weights for Triangular Fuzzy Matrix, weight depend on the entropy measure in the column

Parameters:

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

Returns:

Array of weights based on matrix entropy

Return type:

ndarray

pyfdm.weights.standard_deviation_weights(matrix)[source]

Calculates the objective weights for Triangular Fuzzy Matrix, weight depend on the data standard deviation in the column

Parameters:

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

Returns:

Array of weights based on matrix entropy

Return type:

ndarray

pyfdm.weights.variance_weights(matrix)[source]

Calculates the objective weights for Triangular Fuzzy Matrix, weight depend on the data variance in the column

Parameters:

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

Returns:

Array of weights based on matrix entropy

Return type:

ndarray