General-purpose MCDA methods (ELECTRE I, MAUT) built on mcda-core
Project description
mcda-methods
General-purpose MCDA methods built on mcda-core, maintained by the SMG research group. Currently provides ELECTRE I (choice problems) and MAUT (ranking by multi-attribute utility).
This library is a home for methods that do not yet have a dedicated library. When a method grows large enough to warrant its own package, it will be spun off into a separate repository.
Installation
pip install mcda-methods
Python ≥ 3.10.
Quick start
ELECTRE I
Selects a kernel — the best alternatives in a choice problem — via concordance and veto.
import numpy as np
from mcda_methods import ElectreI, PerformanceTable, ParametersElectre
table = PerformanceTable(
values=np.array([
[8.0, 3.0, 5.0],
[6.0, 7.0, 4.0],
[5.0, 6.0, 9.0],
[7.0, 5.0, 6.0],
]),
alternatives=["A", "B", "C", "D"],
criteria=["C1", "C2", "C3"],
)
params = ParametersElectre(
weights=np.array([0.4, 0.3, 0.3]),
lambda_threshold=0.65, # concordance threshold for outranking
veto_thresholds=np.array([]), # no veto (optional)
)
model = ElectreI(performance_table=table, parameters=params)
model.fit()
print(model.concordance) # (n, n) concordance matrix
print(model.outranking) # (n, n) binary outranking matrix
print(model.kernel) # binary array: 1 = alternative is in the kernel
MAUT
Ranks alternatives via weighted piecewise-linear marginal utility functions.
import numpy as np
from mcda_methods import MAUT, PerformanceTable, ParametersMAUT
table = PerformanceTable(
values=np.array([[80.0, 20.0], [65.0, 35.0], [90.0, 15.0]]),
alternatives=["A", "B", "C"],
criteria=["cost", "quality"],
)
params = ParametersMAUT(
weights=np.array([0.6, 0.4]),
breakpoints=[np.array([60.0, 80.0, 100.0]), # breakpoints per criterion
np.array([10.0, 25.0, 40.0])],
value_functions=[np.array([0.0, 0.5, 1.0]), # utility at each breakpoint
np.array([0.0, 0.7, 1.0])],
)
model = MAUT(performance_table=table, parameters=params)
model.fit()
print(model.utilities) # weighted utility score per alternative
print(model.ranking) # indices sorted best → worst
print(model.mono_criterion_scores()) # unweighted marginal utilities (n × m)
Parameters can also be loaded from a JSON file:
import json
from mcda_methods import ParametersMAUT
with open("params.json") as f:
params = ParametersMAUT.from_dict(json.load(f))
Expected JSON keys: "weights", "breakpoints", "value_functions".
API reference
ElectreI
| attribute / property | description |
|---|---|
concordance |
(n, n) concordance matrix |
veto |
(n, n) binary veto matrix |
outranking |
(n, n) binary outranking matrix |
kernel |
binary (n,) array — 1 = in kernel, or None if no kernel exists |
result() |
returns outranking |
is_valid(kernel) |
check whether a given set is a valid kernel |
ParametersElectre
| field | type | description |
|---|---|---|
weights |
ndarray (m,) |
criterion weights |
lambda_threshold |
float |
concordance threshold (typically 0.5–1.0) |
veto_thresholds |
ndarray (m,) |
per-criterion veto threshold (empty = no veto) |
MAUT
| attribute / property | description |
|---|---|
utilities |
weighted utility score per alternative, shape (n,) |
scores |
alias for utilities |
ranking |
indices sorted best → worst |
result() |
returns utilities |
mono_criterion_scores() |
unweighted marginal utilities, shape (n, m) |
weighted_utility_difference(i, j) |
criterion-wise weighted utility difference, shape (m,) |
MAUT.from_normalized(maut_norm, pt_raw) |
construct a MAUT that operates on raw (unnormalized) values |
ParametersMAUT
| field | type | description |
|---|---|---|
weights |
ndarray (m,) |
criterion weights |
breakpoints |
list[ndarray] |
breakpoint values per criterion (ascending) |
value_functions |
list[ndarray] |
utility at each breakpoint per criterion |
Ecosystem
Part of the modular MCDA Python ecosystem. See mcda-core for the full picture.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcda_methods-0.1.0.tar.gz.
File metadata
- Download URL: mcda_methods-0.1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d82f02b0726e7b192d910172cee44ede836fdd6f1e8e5b7f6ff0f410e0437974
|
|
| MD5 |
7a299139d6006396c653ca568b809bb9
|
|
| BLAKE2b-256 |
078fe2123bd6d45a69aa5cd42d0219c06db4e3b4dbdcb303e6e9d3207d8a2107
|
File details
Details for the file mcda_methods-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcda_methods-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbbf9654eda86f6857a16981c2c6c11c3e0d117d0e0e42baf2039c3aabea88a3
|
|
| MD5 |
004c444f64d039e1e8c1384da2af9b75
|
|
| BLAKE2b-256 |
06824524b71044c508a1bf1e0f52cc849beeb3fbf8c2a3d78c36654fa55d02e2
|