matrix.Matrix.update_criterion_value_to_score

Matrix.update_criterion_value_to_score(continuous_criterion: str, value: float, new_score: float)

Update the value and/or score pair of a given continuous criterion

Parameters
  • continuous_criterion (str) – The name of the continuous criterion whose score is to be updated.

  • value (float) – The criterion value whose score is to be updated.

  • new_score (float) – The new score value.

Examples

>>> import matrix
>>> m = matrix.Matrix('apple')
>>> m.add_continuous_criterion('price', weight=8)
>>> m.criterion_value_to_score('price', {
...     0: 10,
...     3: 5,
...     10: 0
... })
>>> m.value_score_df
   price  price_score
0      0           10
1      3            5
2     10            0
>>> m.update_criterion_value_to_score('price', value=0, new_score=3)
>>> m.value_score_df
   price  price_score
0      0            3
1      3            5
2     10            0