mcda¶
TOPSIS ranking with incomplete rows left unranked.
quakecascade.mcda
¶
Multi-criteria ranking: TOPSIS with incomplete rows left unranked.
TOPSIS (Hwang & Yoon 1981) ranks alternatives by their relative closeness to an ideal and away from an anti-ideal solution:
- vector normalisation \(r_{ij} = x_{ij} / \sqrt{\sum_k x_{kj}^2}\);
- weighting \(v_{ij} = w_j r_{ij}\) with \(\sum_j w_j = 1\);
- ideal \(A^+_j = \max_i v_{ij}\) for a benefit criterion (\(\min\) for a cost criterion) and anti-ideal \(A^-_j\) the opposite;
- separations \(S^\pm_i = \lVert v_i - A^\pm \rVert_2\);
- closeness \(C_i = S^-_i / (S^+_i + S^-_i) \in [0, 1]\), ranked descending.
An alternative with any missing criterion (NaN or ±inf) is not ranked: it gets a NaN score and a status naming what is missing, and it does not enter the normalisation of the others. Missing is never filled with a neutral value.
topsis
¶
Rank alternatives with TOPSIS (Hwang & Yoon 1981).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
DataFrame or (n, m) array
|
Criteria values; columns are criteria (named by the DataFrame, by
|
required |
weights
|
(None, sequence, mapping or Series)
|
Criterion weights (normalised to sum 1). |
None
|
benefit
|
sequence of bool, mapping or Series
|
True where a higher value is better (benefit criterion), False where
lower is better (cost criterion). Required: the direction is a
property of each indicator, never assumed. Only booleans (or 0/1)
are accepted, so a label such as |
None
|
criteria
|
sequence of str
|
Names for array input. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Same index as |
Notes
When every ranked alternative is identical on every criterion, \(S^+ = S^- = 0\) and all scores are set to 0.5 (a full tie).