matrix.Matrix.rate_choice

Matrix.rate_choice(choice: str, **criteria_to_ratings)

Given a choice, assign ratings (dictionary values) to given criteria (dictionary keys).

Parameters

choice (str) – The name of the choice to be evaluated.

Keyword Arguments

**criteria_to_ratings (float) – The criterion-rating pairs.

Raises

ValueError – If any of the given criteria is not continuous.

Examples

>>> import matrix
>>> m = matrix.Matrix(
...     # choices=('apple',),  # No need to add choice here!
...     criteria=('taste', 'color'),
...     weights=(7, 3)
... )
>>> m.rate_choice('apple', taste=7, color=5)
>>> m
|        |   taste |   color | Percentage   |
|:-------|--------:|--------:|:-------------|
| Weight |       7 |       3 |              |
| apple  |       7 |       5 | 64.0         |