Matrix.
values_to_score_from_record
For multiple continuous criteria, declare what score should a choice receive given values for that criterion.
dictionary (dict[str, list[tuple[float, float]]]) – The dictionary with keys for each criteria, and a list of tuples that pairs the criterion value to the score.
Examples
>>> import matrix >>> m = matrix.Matrix() >>> m.add_continuous_criterion('size', weight=4) >>> m.add_continuous_criterion('cost', weight=7) >>> m.values_to_score_from_record({ ... 'size': [(0, 10), (10, 5), (15, 0)], ... 'cost': [(0, 10), (10, 0)], ... }) >>> m.value_score_df size size_score cost cost_score 0 0 10 0.0 10.0 1 10 5 10.0 0.0 2 15 0 NaN NaN
Note
This method has time complexity O(n) in respect to the length of the outer dictionary.