(values: dict[str, float], method: str, direction: str)
| 79 | |
| 80 | |
| 81 | def norm(values: dict[str, float], method: str, direction: str) -> float: |
| 82 | vals = list(values.values()) |
| 83 | lo, hi = min(vals), max(vals) |
| 84 | if hi == lo: |
| 85 | score = 0.5 |
| 86 | else: |
| 87 | score = (values[method] - lo) / (hi - lo) |
| 88 | if direction == "down": |
| 89 | score = 1 - score |
| 90 | return score |
| 91 | |
| 92 | |
| 93 | def x_pos(score: float) -> float: |