skcriteria.agg._agg_base
module¶
Core functionalities to create madm decision-maker classes.
- class skcriteria.agg._agg_base.SKCDecisionMakerABC[source]¶
Bases:
SKCMethodABC
Abstract class for all decisor based methods in scikit-criteria.
- class skcriteria.agg._agg_base.ResultABC(method, alternatives, values, extra)[source]¶
Bases:
object
Base class to implement different types of results.
Any evaluation of the DecisionMatrix is expected to result in an object that extends the functionalities of this class.
- Parameters
method (str) – Name of the method that generated the result.
alternatives (array-like) – Names of the alternatives evaluated.
values (array-like) – Values assigned to each alternative by the method, where the i-th value refers to the valuation of the i-th. alternative.
extra (dict-like) – Extra information provided by the method regarding the evaluation of the alternatives.
- property values¶
Values assigned to each alternative by the method.
The i-th value refers to the valuation of the i-th. alternative.
- property method¶
Name of the method that generated the result.
- property alternatives¶
Names of the alternatives evaluated.
- property extra_¶
Additional information about the result.
Note
e_
is an alias for this property
- property e_¶
Additional information about the result.
Note
e_
is an alias for this property
- property shape¶
Tuple with (number_of_alternatives, ).
rank.shape <==> np.shape(rank)
- values_equals(other)[source]¶
Check if the alternatives and ranking are the same.
The method doesn’t check the method or the extra parameters.
- aequals(other, rtol=1e-05, atol=1e-08, equal_nan=False)[source]¶
Return True if the result are equal within a tolerance.
The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b.
NaNs are treated as equal if they are in the same place and if
equal_nan=True
. Infs are treated as equal if they are in the same place and of the same sign in both arrays.The proceeds as follows:
If
other
is the same object returnTrue
.If
other
is not instance of ‘DecisionMatrix’, has different shape ‘criteria’, ‘alternatives’ or ‘objectives’ returnsFalse
.Next check the ‘weights’ and the matrix itself using the provided tolerance.
- Parameters
other (Result) – Other result to compare.
rtol (float) – The relative tolerance parameter (see Notes in
numpy.allclose()
).atol (float) – The absolute tolerance parameter (see Notes in
numpy.allclose()
).equal_nan (bool) – Whether to compare NaN’s as equal. If True, NaN’s in dm will be considered equal to NaN’s in other in the output array.
- Returns
aequals – Returns True if the two result are equal within the given tolerance; False otherwise.
- Return type
bool:py:class:
See also
equals
,numpy.isclose()
,numpy.all()
,numpy.any()
,numpy.equal()
,numpy.allclose()
- equals(other)[source]¶
Return True if the results are equal.
This method calls aquals without tolerance.
- Parameters
other (
skcriteria.DecisionMatrix
) – Other instance to compare.- Returns
equals – Returns True if the two results are equals.
- Return type
bool:py:class:
See also
aequals
,numpy.isclose()
,numpy.all()
,numpy.any()
,numpy.equal()
,numpy.allclose()
- class skcriteria.agg._agg_base.RankResult(method, alternatives, values, extra)[source]¶
Bases:
ResultABC
Ranking of alternatives.
This type of results is used by methods that generate a ranking of alternatives.
- Parameters
method (str) – Name of the method that generated the result.
alternatives (array-like) – Names of the alternatives evaluated.
values (array-like) – Values assigned to each alternative by the method, where the i-th value refers to the valuation of the i-th. alternative.
extra (dict-like) – Extra information provided by the method regarding the evaluation of the alternatives.
- property has_ties_¶
Return True if two alternatives shares the same ranking.
- property ties_¶
Counter object that counts how many times each value appears.
- property rank_¶
Alias for
values
.
- property untied_rank_¶
Ranking whitout ties.
if the ranking has ties this property assigns unique and consecutive values in the ranking. This method only assigns the values using the command
numpy.argsort(rank_) + 1
.
- class skcriteria.agg._agg_base.KernelResult(method, alternatives, values, extra)[source]¶
Bases:
ResultABC
Separates the alternatives between good (kernel) and bad.
This type of results is used by methods that select which alternatives are good and bad. The good alternatives are called “kernel”
- Parameters
method (str) – Name of the method that generated the result.
alternatives (array-like) – Names of the alternatives evaluated.
values (array-like) – Values assigned to each alternative by the method, where the i-th value refers to the valuation of the i-th. alternative.
extra (dict-like) – Extra information provided by the method regarding the evaluation of the alternatives.
- property kernel_¶
Alias for
values
.
- property kernel_size_¶
How many alternatives has the kernel.
- property kernel_where_¶
Indexes of the alternatives that are part of the kernel.
- property kernelwhere_¶
Indexes of the alternatives that are part of the kernel.
Deprecated since version 0.7: Use
kernel_where_
instead
- property kernel_alternatives_¶
Return the names of alternatives in the kernel.