matrix.Matrix.criteria_values_to_scores

Matrix.criteria_values_to_scores(criteria_names: list[str], all_values: list[list[float]], all_scores: list[list[float]])

For multiple continuous criteria, declare what score should a choice receive given values for that criterion.

Parameters
  • criteria_names (list[str]) – The names of the criteria.

  • all_values (list[list[float]]) – The collection of criterion values. The outer list should have a length equal to criteria_names.

  • all_scores (list[list[float]]) – The collection of criterion scores. The outer list should have a length equal to criteria_names.

Examples

>>> import matrix
>>> m = matrix.Matrix()
>>> m.add_continuous_criterion('size', weight=4)
>>> m.add_continuous_criterion('cost', weight=7)
>>> m.criteria_values_to_scores(
...     ['size', 'cost'],
...     all_values=[[0, 10, 15], [0, 10]],
...     all_scores=[[10, 5, 0], [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 criteria.