safety_score

Formula

safety_score = clamp(100 - 50*collision_count - 20*offroad_count - 10*red_light_violations - 5*hard_brake_count - 10*timeout_penalty, 0, 100)

timeout_penalty is 1 when the run timed out, otherwise 0.

Hand-Computable Example

Input: collision_count=1, offroad_count=1, red_light_violations=1, hard_brake_count=1, timeout=true.

Expected output: 5.0.

Calculation: 100 - 50 - 20 - 10 - 5 - 10 = 5.

Edge Cases

  • Scores below 0 clamp to 0.
  • Scores above 100 clamp to 100.
  • Missing counts default to 0.

Limitations

This is a deterministic regression score, not a formal risk or production safety model.

Test References

  • tests/golden/test_safety_score_golden.py
  • tests/test_metrics.py