Skip to main content

Library for Multi-criteria Decision Aid Methods

Project description

scikit-mcda

It is a python library made to provide multi-criteria decision aid for developers and operacional researchers.

Scikit-mcda provides an easy way to apply several popular decision-making methods. It can be used as part of your development or for analytical experiments using notebooks like Jupyter, colab or kaggle. The package is available on the Pypi allowing installation by pip install scikit-mcda command.

Some methods available

DMUU: laplace, hurwicz, maximax, maximin, minimax-regret ... MCDA: Weighted Sum Model (WSM), Weighted Product Model (WPM) , Weighted Aggregated Sum Product Assessment (WASPAS), TOPSIS ... Definition of criteria weights: Manually, Entropy, Ranking Methods ... Nomalization: Z score, MinMax, Logistic, Max, Sum and RootSumSquared

Scikit-mcda is free to use for personal, commercial and academic projects, always respecting the terms of the Apache 2.0 License. Do not forget to refer to this Library when it is used in your experiments, lectures, presentations, classes and research papers. The reference must follow this citation format.

(HORTA, 2021)

HORTA, Antonio (2021). Scikit-mcda: The Python library for multi-criteria decision aid. 
Version 0.21. [opensource], 17 jan. 2021. Available in: https://gitlab.com/cybercrafter/scikit-mcda. 
Acessed in: 17 jan. 2021.

It's a project made by Cybercrafter® ajhorta@cybercrafter.com.br

Module for Decision-making Under Uncertainty (DMUU)

DMUU: Class Module for Decision-making Under Uncertainty

Attributes:

df_original = DataFrame
df_calc = DataFrame
decision = {"alternative":,
            "index":,
            "value": ,
            "criteria": ,
            "result": ,
            "type_dm": "DMUU",
            "hurwicz_coeficient":}

Criteria Methods:

  • maximax()
  • maximin()
  • laplace()
  • minimax_regret()
  • hurwicz(coef)

Properties

  • pretty_original(tablefmt='psql')
  • pretty_calc(tablefmt='psql')
  • pretty_decision(tablefmt='psql')

tablefmt: "psql" or "latex" or "html"

Methods:

  • dataframe(alt_data, alt_labels=[], state_labels=[])
  • decision_making(dmuu_criteria_list=[])

Quick Start for DMUU

from scikitmcda.dmuu import DMUU

# Defining labels for Alternatives and States")

dmuu = DMUU()

dmuu.dataframe([[5000, 2000, 100],
                [50, 50, 500]],
                ["ALT_A", "ALT_B"],
                ["STATE A", "STATE B", "STATE C"]
                )

print(dmuu.pretty_original())
+----+----------------+-----------+-----------+-----------+
|    | alternatives   |   STATE A |   STATE B |   STATE C |
|----+----------------+-----------+-----------+-----------|
|  0 | ALT_A          |      5000 |      2000 |       100 |
|  1 | ALT_B          |        50 |        50 |       500 |
+----+----------------+-----------+-----------+-----------+

# Specifying the criteria method

dmuu.minimax_regret()

print(dmuu.pretty_calc())
+----+----------------+-----------+-----------+-----------+------------------+
|    | alternatives   |   STATE A |   STATE B |   STATE C | minimax-regret   |
|----+----------------+-----------+-----------+-----------+------------------|
|  0 | ALT_A          |      5000 |      2000 |       100 | (400, 1)         |
|  1 | ALT_B          |        50 |        50 |       500 | (4950, 0)        |
+----+----------------+-----------+-----------+-----------+------------------+

print(dmuu.pretty_decision())
+---------------+---------+---------+----------------+-------------------------------+-----------+----------------------+
| alternative   |   index |   value | criteria       | result                        | type_dm   | hurwicz_coeficient   |
|---------------+---------+---------+----------------+-------------------------------+-----------+----------------------|
| ALT_A         |       0 |     400 | minimax-regret | {'ALT_A': 400, 'ALT_B': 4950} | DMUU      |                      |
+---------------+---------+---------+----------------+-------------------------------+-----------+----------------------+

# Many crietria methods

dmuu.decision_making([dmuu.maximax(), dmuu.maximin(), dmuu.hurwicz(0.8), dmuu.minimax_regret()])

print(dmuu.pretty_calc())
+----+----------------+-----------+-----------+-----------+------------------+-----------+-----------+------------------+
|    | alternatives   |   STATE A |   STATE B |   STATE C | minimax-regret   | maximax   | maximin   | hurwicz          |
|----+----------------+-----------+-----------+-----------+------------------+-----------+-----------+------------------|
|  0 | ALT_A          |      5000 |      2000 |       100 | (400, 1)         | (5000, 1) | (100, 1)  | (4020.0, 1, 0.8) |
|  1 | ALT_B          |        50 |        50 |       500 | (4950, 0)        | (500, 0)  | (50, 0)   | (410.0, 0, 0.8)  |
+----+----------------+-----------+-----------+-----------+------------------+-----------+-----------+------------------+

print(dmuu.pretty_decision())
+---------------+---------+---------+----------------+-----------------------------------+-----------+----------------------+
| alternative   |   index |   value | criteria       | result                            | type_dm   | hurwicz_coeficient   |
|---------------+---------+---------+----------------+-----------------------------------+-----------+----------------------|
| ALT_A         |       0 |    5000 | maximax        | {'ALT_A': 5000, 'ALT_B': 500}     | DMUU      |                      |
| ALT_A         |       0 |     100 | maximin        | {'ALT_A': 100, 'ALT_B': 50}       | DMUU      |                      |
| ALT_A         |       0 |    4020 | hurwicz        | {'ALT_A': 4020.0, 'ALT_B': 410.0} | DMUU      | 0.8                  |
| ALT_A         |       0 |     400 | minimax-regret | {'ALT_A': 400, 'ALT_B': 4950}     | DMUU      |                      |
+---------------+---------+---------+----------------+-----------------------------------+-----------+----------------------+

dmuu.calc_clean()
print(dmuu.pretty_calc())
+----+----------------+-----------+-----------+-----------+
|    | alternatives   |   STATE A |   STATE B |   STATE C |
|----+----------------+-----------+-----------+-----------|
|  0 | ALT_A          |      5000 |      2000 |       100 |
|  1 | ALT_B          |        50 |        50 |       500 |
+----+----------------+-----------+-----------+-----------+

Module for Multi-Criteria Decision Aid (MCDA)

MCDA: Class Module for Multi-Criteria Decision-Aid

Attributes:

  • df_original
  • weights
  • signals
  • df_normalized
  • df_weighted
  • df_pis
  • df_nis
  • df_distances
  • df_decision

MCDA basis methods:

  • dataframe(alt_data, alt_labels=[], state_labels=[])
  • set_signals([MIN, MIN, MAX])
  • set_normalization(default=RootSumSquared_)

Normalization constants: ZScore_, MinMax_, Logistic_, Max_, Sum_, RootSumSquared_

MCDA weights determination methods:

  • set_weights_manually([])
  • set_weights_by_entropy(normalization_method_for_entropy=Default)
  • set_weights_by_ranking_A()
  • set_weights_by_ranking_B()
  • set_weights_by_ranking_B_POW(default=0)
  • set_weights_by_ranking_C()

Ranking methods A, B, B_POW and C need criteria ordered by importance C1> c2> C3 ...

Decision-Making methods:

  • topsis()
  • wsm()
  • wpm()
  • waspas(lambda=0.5)

Properties

  • pretty_original(tablefmt='psql')
  • pretty_normalized(tablefmt='psql')
  • pretty_weighted(tablefmt='psql')
  • pretty_Xis(tablefmt='psql')
  • pretty_decision(tablefmt='psql')

tablefmt: "psql" or "latex" or "html"

Quick Start for MCDA

from scikitmcda.mcda import MCDA
from scikitmcda.constants import MAX, MIN, ZScore_, MinMax_, Logistic_, Max_, Sum_, RootSumSquared_ 


mcda = MCDA()

mcda.dataframe([[90, 20, 86],
                [120, 8, 120],
                [70, 12, 90]],
                ["ALTERNATIVE A", "ALTERNATIVE B", "ALTERNATIVE C"],
                ["COST", "TIME", "SPEED"]
                )

print(mcda.pretty_original())
+----+----------------+--------+--------+---------+
|    | alternatives   |   COST |   TIME |   SPEED |
|----+----------------+--------+--------+---------|
|  0 | ALTERNATIVE A  |     90 |     20 |      86 |
|  1 | ALTERNATIVE B  |    120 |      8 |     120 |
|  2 | ALTERNATIVE C  |     70 |     12 |      90 |
+----+----------------+--------+--------+---------+

# defining weights and signals for decision by TOPSIS 
mcda.set_weights_manually([0.5, 0.3, 0.2])
# or mcda.set_weights_by_entropy()

mcda.set_signals([MIN, MIN, MAX])
mcda.set_normalization_method(RootSumSquared_)
mcda.topsis()

print(mcda.pretty_normalized())
+----+----------------+----------+----------+----------+
|    | alternatives   |     COST |     TIME |    SPEED |
|----+----------------+----------+----------+----------|
|  0 | ALTERNATIVE A  | 0.54371  | 0.811107 | 0.497384 |
|  1 | ALTERNATIVE B  | 0.724947 | 0.324443 | 0.694024 |
|  2 | ALTERNATIVE C  | 0.422885 | 0.486664 | 0.520518 |
+----+----------------+----------+----------+----------+

print(mcda.pretty_weighted())
+----+----------------+----------+-----------+-----------+
|    | alternatives   |     COST |      TIME |     SPEED |
|----+----------------+----------+-----------+-----------|
|  0 | ALTERNATIVE A  | 0.271855 | 0.243332  | 0.0994768 |
|  1 | ALTERNATIVE B  | 0.362473 | 0.0973329 | 0.138805  |
|  2 | ALTERNATIVE C  | 0.211443 | 0.145999  | 0.104104  |
+----+----------------+----------+-----------+-----------+

print(mcda.pretty_Xis())
+-----+----------+-----------+-----------+
|     |     COST |      TIME |     SPEED |
|-----+----------+-----------+-----------|
| PIS | 0.211443 | 0.0973329 | 0.138805  |
| NIS | 0.362473 | 0.243332  | 0.0994768 |
+-----+----------+-----------+-----------+

print(mcda.pretty_decision())
+----+----------------+-------------+--------+
|    | alternatives   |   euclidian |   rank |
|----+----------------+-------------+--------|
|  0 | ALTERNATIVE C  |    0.945809 |      1 |
|  1 | ALTERNATIVE B  |    0.413933 |      2 |
|  2 | ALTERNATIVE A  |    0.35164  |      3 |
+----+----------------+-------------+--------+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit-mcda-0.21.8.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

scikit_mcda-0.21.8-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file scikit-mcda-0.21.8.tar.gz.

File metadata

  • Download URL: scikit-mcda-0.21.8.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for scikit-mcda-0.21.8.tar.gz
Algorithm Hash digest
SHA256 df83519e2896f81ac090f8c3c122cdd150de003fd753585e07ddc5f455966ed7
MD5 c82d90bbb62b7894aceed075ef9d671d
BLAKE2b-256 358ca0aedda7f31f56666a6fed4617f648e9bf9eced215448ed9c27823a24086

See more details on using hashes here.

Provenance

File details

Details for the file scikit_mcda-0.21.8-py3-none-any.whl.

File metadata

  • Download URL: scikit_mcda-0.21.8-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for scikit_mcda-0.21.8-py3-none-any.whl
Algorithm Hash digest
SHA256 beddd6517d41da4886c2b4acc4185f3a253dbdf70f4e87dce62fc341c5811c9f
MD5 b968c5397ab8f281e202e30ee39e6a15
BLAKE2b-256 adfdadfc1969a4705310098cd0ee86f199ccea96a42e4805891c5ab6a786b54a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page