Matrix.
rate_choices
Given some choices, assign ratings (dictionary values) to given criteria (dictionary keys).
choices_and_criteria_to_ratings (dict[str, dict[str, float]]) – The nested dictionary containing the choices and the ratings for each criteria.
ValueError – * If any of the given criteria is not continuous.
ValueError
If any of the given criteria has not been added yet; its weight is unknown.
Examples
>>> import matrix >>> m = matrix.Matrix( ... criteria=('taste', 'color'), # No need to add choices here ... weights=(7, 3) ... ) >>> m.rate_choices({ ... 'apple': {'taste': 7, 'color': 5}, ... 'orange': {'taste': 9, 'color': 3} ... }) >>> m | | taste | color | Percentage | |:-------|--------:|--------:|:-------------| | Weight | 7 | 3 | | | apple | 7 | 5 | 64.0 | | orange | 9 | 3 | 72.0 |