mcda

This package contains MCDA algorithms and utilities.

Core features are directly accessible from this subpackage, while each family of MCDA algorithms has its own subpackage.

class PerformanceTable(data, scales=None, alternatives=None, criteria=None, stype=None, **kwargs)

Bases: IValueMatrix[S], Generic[S]

This class defines a performance table.

Parameters
  • data

  • scales (Union[S, Mapping[Any, S], None]) – data scale(s) (one per column or one shared, will be inferred from data if absent using Scale.fit())

  • alternatives (Union[List, None]) – if not set, inferred from data

  • criteria (Union[List, None]) – if not set, inferred from data

  • stype (Union[Type[S], None]) – scales type used

Raises
  • KeyError

    • if some indexes are duplicated

    • if some columns are duplicated

  • TypeError – if stype and scales types mismatch

property alternatives: List

Return performance table alternatives

property alternatives_values: Mapping[Any, Values[S]]

Iterator on the table alternatives values

property bounds: Mapping[Any, S]

Return scales inferred from values.

property cell: Mapping[Tuple[Any, Any], Any]

Return matrix cell accessor.

Note

actually returns DataFrame.at() from data

property columns: List

Return column labels.

property columns_values: Mapping[Any, CommensurableValues[S]]

Iterator on the table criteria values

classmethod concat(matrices, axis=0, **kwargs)

Concatenate multiple value matrices.

Parameters
  • matrices (Sequence[IValueMatrix]) –

  • axis (Literal[0, 1]) – axis along which to concatenate (0: add alternatives, 1: add criteria)

Returns

concatenated value matrix

Return type

Self

Warning

matrices objects are concatenated as is, no transformation of scales is applied.

copy()

Return a copy of the object

Return type

Self

property criteria: List

Return performance table criteria

property criteria_values: Mapping[Any, CommensurableValues[S]]

Iterator on the table criteria values

property efficients: List

Return efficient alternatives.

This is the list of alternatives that are not strongly dominated by another one.

Returns

property is_numeric: bool

Check whether table is numeric.

Returns

Return type

bool

property is_ordinal: bool

Check whether scales are all ordinal.

Returns

property is_within_scales: bool

Check whether all values are within their respective scales.

Returns

property rows: List

Return row labels.

property rows_values: Mapping[Any, Values[S]]

Iterator on the table alternatives values

subtable(rows=None, columns=None)

Return the subtable containing given rows and columns.

Parameters
  • rows (Optional[List]) –

  • columns (Optional[List]) –

Returns

Return type

Self

sum(axis=None)

Return the sum of the data (all table, row or column-wise).

Parameters

axis (Optional[Literal[0, 1]]) –

  • 0: column-wise sum

  • 1: row-wise sum

  • None: complete sum

Returns

Return type

Union[CommensurableValues[QuantitativeScale], float]

Warning

it will raise a TypeError if data contains numeric and non-numeric values

property to_numeric: PerformanceTable[QuantitativeScale]

Return numeric conversion of ordinal values.

Raises

TypeError – if scales are not ordinal

property union_bounds: S

Return one scale for whole matrix inferred from values.

property within_scales: DataFrame

Return a dataframe indicating which values are within their respective scale.

Returns

normalize(data, in_scales=None)

Normalize input data.

Output type is the same as input data type.

Parameters
Returns

normalized data (new object)

Raises

TypeError – if type of arguments are not supported

Return type

Union[Any, Series, Values[QuantitativeScale], CommensurableValues[QuantitativeScale], DataFrame, AdjacencyValueMatrix[QuantitativeScale], PerformanceTable[QuantitativeScale], PartialValueMatrix[QuantitativeScale]]

transform(data, out_scales, in_scales=None)

Transform input data to new scales.

Output type is the same as input data type.

Parameters
Returns

transformed data (new object)

Raises

TypeError – if type of arguments are not supported

Return type

Union[Any, Series, Values[S], CommensurableValues[S], DataFrame, AdjacencyValueMatrix[S], PerformanceTable[S], PartialValueMatrix[S]]

Subpackages:

Submodules: