Skip to content

Commit

Permalink
docs done
Browse files Browse the repository at this point in the history
  • Loading branch information
juanbc committed May 7, 2022
1 parent f90b2b6 commit da542be
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 12 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
## Version 0.7

- **New method**: `ELECTRE2`.

- **New preprocessin strategy:** A new way to transform from minimization to
maximization criteria: `NegateMinimize()` which reverses the sign of the
values of the criteria to be minimized (useful for not breaking distance
relations in methods like *TOPSIS*). Additionally the previous we rename the
`MinimizeToMaximize()` transformer to `InvertMinimize()`.
- Now the `RankingResult`, support repeated/tied rankings and some were
implemented to deal with these cases.

- `RankingResult.has_ties_` to see if there are tied values.
- `RankingResult.ties_` to see how often values are repeated.
- `RankingResult.untided_rank_` to get a ranking with no repeated values.
repeated values.

- `KernelResult` now implements several new properties:

- `kernel_alternatives_` to know which alternatives are in the kernel.
Expand Down
9 changes: 6 additions & 3 deletions docs/source/_dynamic/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Version 0.7
-----------


*
**New method**\ : ``ELECTRE2``.

* **New method**\ : ``ELECTRE2``.
* **New preprocessin strategy:** A new way to transform from minimization to
maximization criteria: ``NegateMinimize()`` which reverses the sign of the
values of the criteria to be minimized (useful for not breaking distance
relations in methods like *TOPSIS*\ ). Additionally the previous we rename the
``MinimizeToMaximize()`` transformer to ``InvertMinimize()``.
*
Now the ``RankingResult``\ , support repeated/tied rankings and some were
implemented to deal with these cases.
Expand Down
29 changes: 29 additions & 0 deletions docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,35 @@ @article{roy1968classement
publisher = {EDP Sciences}
}

@book{gomez2004tomada,
author = {Gomes, Luiz and González-Araya, Marcela and Carignano, Claudia},
year = {2004},
month = {11},
pages = {},
title = {Tomada de decisões em cenários complexos},
isbn = {85-221-0354-2},
publisher = {Thomson}
}


@article{roy1971methode,
title = {La m{\'e}thode Electre II},
author = {Roy, Bernard and Bertier, Patrice},
journal = {Note de travail},
volume = {142},
year = {1971}
}

@article{roy1973methode,
title = {La M{\'e}thode ELECTRE II(Une application au m{\'e}dia-planning...)},
author = {Roy, Bertier and Bertier, Patrice},
year = {1973},
journal = {VII {\`e}me Conf{\`e}rence internationale de recherch{\'e} op{\'e}rationalle},
publisher = {Metra international}
}



% skcriteria.madm.moora
@article{brauers2006moora,
Expand Down
4 changes: 2 additions & 2 deletions skcriteria/madm/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _validate_result(self, values):

@property
def has_ties_(self):
"""True if two alternatives shares the same ranking."""
"""Return True if two alternatives shares the same ranking."""
values = self.values
return len(np.unique(values)) != len(values)

Expand Down Expand Up @@ -291,7 +291,7 @@ def kernel_(self):

@property
def kernel_size_(self):
"""How many alternatives has the kernel"""
"""How many alternatives has the kernel."""
return np.sum(self.kernel_)

@property
Expand Down
49 changes: 44 additions & 5 deletions skcriteria/madm/electre.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def electre1(matrix, objectives, weights, p=0.65, q=0.35):


class ELECTRE1(SKCDecisionMakerABC):
"""Find a the kernel solution through ELECTRE-1.
"""Find a kernel of alternatives through ELECTRE-1.
The ELECTRE I model find the kernel solution in a situation where true
criteria and restricted outranking relations are given.
Expand Down Expand Up @@ -198,7 +198,16 @@ def _make_result(self, alternatives, values, extra):


def weights_outrank(matrix, weights, objectives):
"""Calculate a matrix of comparison of alternatives where the value of \
each cell determines how many times the value of the criteria weights of \
the row alternative exceeds those of the column alternative.
Notes
-----
For more information about this matrix please check "Tomada de decisões em
cenários complexos" :cite:p:`gomez2004tomada`, p. 100
"""
alt_n = len(matrix)
alt_combs = it.combinations(range(alt_n), 2)
outrank = np.full((alt_n, alt_n), False, dtype=bool)
Expand Down Expand Up @@ -230,8 +239,6 @@ def _electre2_ranker(
alt_n, original_outrank_s, original_outrank_w, invert_ranking
):

# Here we create the ranking loop

# here we store the final rank
ranking = np.zeros(alt_n, dtype=int)

Expand Down Expand Up @@ -294,7 +301,6 @@ def electre2(
matrix, objectives, weights, p0=0.65, p1=0.5, p2=0.35, q0=0.65, q1=0.35
):
"""Execute ELECTRE2 without any validation."""

matrix_concordance = concordance(matrix, objectives, weights)
matrix_discordance = discordance(matrix, objectives)
matrix_wor = weights_outrank(matrix, objectives, weights)
Expand Down Expand Up @@ -340,7 +346,40 @@ def electre2(


class ELECTRE2(SKCDecisionMakerABC):
"""Find a the rankin solution through ELECTRE-2."""
"""Find the rankin solution through ELECTRE-2.
ELECTRE II was proposed by Roy and Bertier (1971-1973) to overcome ELECTRE
I's inability to produce a ranking of alternatives. Instead of simply
finding the kernel set, ELECTRE II can order alternatives by introducing
the strong and the weak outranking relations.
Notes
-----
This implementation is based on the one presented in the book
"Tomada de decisões em cenários complexos" :cite:p:`gomez2004tomada`.
Parameters
----------
p0, p1, p2 : float, optional (default=0.65, 0.5, 0.35)
Matching thresholds. These are the thresholds that indicate the extent
to which an alternative can be considered equivalent, good or very good
with respect to another alternative.
These thresholds must meet the condition "1 >= p0 >= p1 >= p2 >= 0".
q0, q1 : float, optional (default=0.65, 0.35)
Discordance threshold. Threshold of the degree to which an alternative
is equivalent, preferred or strictly preferred to another alternative.
These thresholds must meet the condition "1 >= q0 >= q1 >= 0".
References
----------
:cite:p:`gomez2004tomada`
:cite:p:`roy1971methode`
:cite:p:`roy1973methode`
"""

_skcriteria_parameters = ["p0", "p1", "p2", "q0", "q1"]

Expand Down

0 comments on commit da542be

Please sign in to comment.