Lab 02 — Pareto Analyzer

Phase: 09 — Model Accuracy Evaluation | Difficulty: ⭐⭐⭐⭐⭐ | Time: 3–4 hours

When optimizing for both accuracy AND latency, no single "best" model exists — you need Pareto analysis.

What you build

  • ModelPoint — dataclass with accuracy, latency_ms, model_name
  • dominates(a, b) — Pareto dominance: a dominates b iff both ≥ and at least one strict
  • compute_pareto_front — filter out all dominated models
  • find_knee_point — maximize distance from utopian point (1,1) in normalized space
  • weighted_score — combine metrics with configurable weights
  • rank_by_weighted_score — sorted ranking for decision-making

Key concepts

ConceptWhat to understand
Pareto dominancea dominates b: a is no worse in all objectives and better in ≥1
Pareto frontSet of non-dominated models — the "best tradeoffs"
Knee pointModel closest to utopian (max accuracy, min latency) — practical default
Utopian point(best_accuracy, best_latency) — unreachable but guides selection

Files

FilePurpose
lab.pyStubs with TODO markers
solution.pyComplete working implementation
test_lab.pypytest suite
requirements.txtDependencies

Run

pip install -r requirements.txt
python lab.py
pytest test_lab.py -v