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(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,) |
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 |
MAUTLinear (mockup)
MAUTLinear is a simplified MAUT implementation with per-criterion affine (linear) value functions: a weighted sum of min-max normalized scores. It is included as a reference implementation to illustrate the ecosystem conventions (see notebooks/implementing_mcda_method.ipynb), not as a production-ready method. For real use cases, prefer MAUT with explicitly elicited value functions.
import numpy as np
from mcda_methods import MAUTLinear, PerformanceTable, ParametersMAUTLinear
table = PerformanceTable(
values=np.array([[80.0, 20.0], [65.0, 35.0], [90.0, 15.0]]),
alternatives=["A", "B", "C"],
criteria=["cost", "quality"],
directions=np.array([-1, 1]), # cost: minimize, quality: maximize
)
params = ParametersMAUTLinear(
weights=np.array([0.6, 0.4]),
lb=table.values.min(axis=0),
ub=table.values.max(axis=0),
)
model = MAUTLinear(performance_table=table, parameters=params)
model.fit()
print(model.scores) # weighted utility score per alternative
print(model.ranking) # indices sorted best -> worst
ParametersMAUTLinear
| field | type | description |
|---|---|---|
weights |
ndarray (m,) |
criterion weights |
lb |
ndarray (m,) |
lower normalization bound per criterion (maximization space) |
ub |
ndarray (m,) |
upper normalization bound per criterion (maximization space) |
breakpoints |
tuple |
breakpoint positions for non-affine criteria (optional) |
value_functions |
tuple |
utility values at each breakpoint for non-affine criteria (optional) |
Ecosystem
Part of the modular MCDA Python ecosystem. See mcda-core for the full picture.
License
MIT — see LICENSE.
Metadata
Release files for mcda-methods 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcda_methods-0.2.0.tar.gz | 18.6 kB | Without provenance | Details for mcda_methods-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcda_methods-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mcda_methods-0.2.0-py3-none-any.whl |
Total release size: 35.4 kB
Release files / mcda_methods-0.2.0.tar.gz
| Download URL | mcda_methods-0.2.0.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab9a8c053204542d4c595ba0a956588d3810ee067471bdfba97b26ae1bee3120
|
|
BLAKE2b-256 checksum How to use checksums |
5c7ad853f854939e1194028605c77d4d7b6f809a9eec39f794f34b2dab6bee1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / mcda_methods-0.2.0-py3-none-any.whl
| Download URL | mcda_methods-0.2.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5709ea59e213fb3b645774c80550cb456666ddc2656594d50258dad79edea14
|
|
BLAKE2b-256 checksum How to use checksums |
ccc9285b8c6736028b621acf22301fa743b9af0855f23d67450d1b21dc486e84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for mcda-methods 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.