types
This module gathers types used throughout the package.
- BinaryScale
Type alias for binary scale
- Function
Type alias for single argument python functions (callables).
alias of
Callable
[[Any
],Any
]
- NormalScale
Type alias for normal scale
- NumericFunction
Type alias for single argument python numeric functions (callables).
alias of
Callable
[[float
],float
]
- class OrdinalScale(preference_direction=None, **kwargs)
Bases:
Scale
,ABC
This class defines a MCDA ordinal scale.
- Parameters
preference_direction (Union[PreferenceDirection, None]) –
- classmethod fit(data, preference_direction=None, **kwargs)
Create a scale that fits the data.
- Parameters
data (Series) –
preference_direction (Optional[PreferenceDirection]) –
- Returns
scale
- Return type
Self
- is_better(x, y)
Check if x is better than y according to this scale.
- Parameters
x (Any) –
y (Any) –
- Returns
- Return type
bool
- is_better_or_equal(x, y)
Check if x is better or equal to y according to this scale
- Parameters
x (Any) –
y (Any) –
scale –
- Returns
- Return type
bool
- abstract label(x)
Return scale value corresponding to given number.
- Parameters
x (float) –
- Returns
- Return type
Any
- abstract property numeric: QuantitativeScale
Return corresponding numeric scale.
- abstract range(nb=None)
Return range of value from scale.
- Parameters
nb (Optional[int]) – number of values to return
- Returns
- Return type
List
- abstract value(x)
Return corresponding numeric value.
- Parameters
x (Any) –
- Returns
- Return type
float
- class Relation(a, b)
Bases:
ABC
This class represents a pairwise relation between two elements.
- Parameters
a (Any) – first element
b (Any) – second element
- Attribute a
- Attribute b
- Attribute DRAW_STYLE
(class) key args for plotting all instances
- DRAW_STYLE: Dict[str, Any] = {'style': 'invis'}
- compatible(other)
Check whether both relations can coexist in the same preference structure.
Relations are compatible if equal or having different elements pair.
- Parameters
other (Relation) –
- Returns
check result
- Return type
bool
Warning
Does not check for relations’ validity!
- property elements: Tuple[Any, Any]
Return elements of the relation
- same_elements(relation)
Check whether the relations are about the same pair of alternatives.
- Parameters
relation (Relation) – second relation
- Returns
True
if both relations share the same elements pair,False
otherwise- Return type
bool
Warning
Does not check for relations’ validity!
- static types()
Return list of relation types.
- Returns
- Return type
List
- class Scale(**kwargs)
Bases:
ABC
Basic abstract class for MCDA scale.
- Attr preference_direction
- classmethod fit(data, **kwargs)
Create a scale that fits the data.
- Parameters
data (Series) –
- Returns
scale
- Return type
Self
- is_better(x, y)
Check if x is better than y according to this scale.
- Parameters
x (Any) –
y (Any) –
- Returns
- Raises
TypeError – if scale is not ordinal
- Return type
bool
- is_better_or_equal(x, y)
Check if x is better or equal to y according to this scale
- Parameters
x (Any) –
y (Any) –
scale –
- Returns
- Return type
bool
- abstract range(nb=None)
Return range of value from scale.
- Parameters
nb (Optional[int]) – number of values to return
- Returns
- Return type
List