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 withaccuracy,latency_ms,model_namedominates(a, b)— Pareto dominance: a dominates b iff both ≥ and at least one strictcompute_pareto_front— filter out all dominated modelsfind_knee_point— maximize distance from utopian point (1,1) in normalized spaceweighted_score— combine metrics with configurable weightsrank_by_weighted_score— sorted ranking for decision-making
Key concepts
| Concept | What to understand |
|---|---|
| Pareto dominance | a dominates b: a is no worse in all objectives and better in ≥1 |
| Pareto front | Set of non-dominated models — the "best tradeoffs" |
| Knee point | Model closest to utopian (max accuracy, min latency) — practical default |
| Utopian point | (best_accuracy, best_latency) — unreachable but guides selection |
Files
| File | Purpose |
|---|---|
lab.py | Stubs with TODO markers |
solution.py | Complete working implementation |
test_lab.py | pytest suite |
requirements.txt | Dependencies |
Run
pip install -r requirements.txt
python lab.py
pytest test_lab.py -v