mcda-core
Foundation library for the MCDA Python ecosystem. Provides the shared data structures, abstract interfaces, and data transformations that all other libraries in the ecosystem build on.
Installation
pip install mcda-core
Python ≥ 3.9, NumPy ≥ 1.25, pandas ≥ 2.0.
Quick start
import numpy as np
import pandas as pd
from mcda_core import PerformanceTable, minmax, zscore
# Build a performance table from raw values
table = PerformanceTable(
values=np.array([
[80.0, 20.0, 10.0],
[65.0, 35.0, 18.0],
[90.0, 15.0, 14.0],
]),
alternatives=["A", "B", "C"],
criteria=["cost", "quality", "CO2"],
directions=[-1, 1, -1], # minimise cost and CO2, maximise quality
)
# Or load from a CSV
df = pd.read_csv("data.csv", index_col="alternative")
table = PerformanceTable.from_dataframe(df, directions=[-1, 1, -1])
# Normalise — returns a new (immutable) PerformanceTable
norm = minmax(table)
# Convert minimisation criteria to maximisation before passing to a method
table_max = table.as_maximization()
What's included
PerformanceTable
The central data structure — a frozen dataclass wrapping a (n, c) float array of n alternatives × c criteria, together with:
| attribute | type | default |
|---|---|---|
values |
NDArray shape (n, c) |
required |
alternatives |
list[str] |
None |
criteria |
list[str] |
None |
criteria_types |
list[str] |
all "cardinal" |
directions |
list[int] |
all +1 (maximise) |
Key methods: from_dataframe(), as_maximization(), to_dataframe(), .shape.
Interfaces
| class | purpose |
|---|---|
MCDAMethod[P] |
Abstract base for all MCDA methods — requires fit() and result() |
MCDAParameters |
Abstract base for method parameters |
KEY_WEIGHTS is the shared string constant for the weights key.
Transformations
All transformations take a PerformanceTable and return a new one (metadata preserved):
| function | description |
|---|---|
minmax(table) |
(x − min) / (max − min) → [0, 1] |
zscore(table) |
(x − μ) / σ |
sum_normalization(table) |
x / Σx |
max_scaling(table) |
x / max(|x|) |
invert_criteria(table) |
Flip criteria with direction = −1; method: "range" (default) or "sign" |
scores_to_ranking(scores) |
Indices of alternatives sorted best → worst; higher_is_better=True (default) |
All table transformations accept an optional criteria argument (list of column indices) to apply the transformation to a subset of criteria.
Ecosystem
This library is the foundation of a modular MCDA ecosystem:
| library | role | repository |
|---|---|---|
| mcda-core | ← you are here | gitlab.ulb.be/smg/mcda-core |
| promethee | PROMETHEE I/II/Gamma/Sort | gitlab.ulb.be/smg/promethee |
| mcda-methods | ELECTRE I, MAUT | gitlab.ulb.be/smg/mcda-methods |
| mcda-viz | Visualization dashboards (Dash/Plotly) | gitlab.ulb.be/smg/mcda-viz |
New method libraries only need to depend on mcda-core and inherit from MCDAMethod to be fully compatible with the rest of the ecosystem.
License
MIT — see LICENSE.
Metadata
Release files for mcda-core 0.3.1
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_core-0.3.1.tar.gz | 15.2 kB | Without provenance | Details for mcda_core-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcda_core-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for mcda_core-0.3.1-py3-none-any.whl |
Total release size: 26.1 kB
Release files / mcda_core-0.3.1.tar.gz
| Download URL | mcda_core-0.3.1.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b12f2988a6d3b3c7e09da51899e172de172e82c401d927f26a2a09ee7ae7e1ba
|
|
BLAKE2b-256 checksum How to use checksums |
ac66fbf2b565dff9317bf002e3cae6e7ad6918c21a63f31c60fc34a43a712816
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.20
|
Release files / mcda_core-0.3.1-py3-none-any.whl
| Download URL | mcda_core-0.3.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de9f7b439379730ab4dac2d8097e44d0c3ed268280dc7caffca5d29e289a5cbb
|
|
BLAKE2b-256 checksum How to use checksums |
83982c98e9fe56c8665d63d7969cc4c3598d7736ad5e5768e88e0bd2f237363f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.20
|
Security for mcda-core 0.3.1
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.