BEGINNER • Python Data Foundation
Evaluation Playbook for health triage support model #4
This lesson focuses on optimize inference latency using a practical health triage support model scenario. You will apply commands: python script.py | df.describe() | plt.plot(). The code example demonstrates a concrete workflow aligned with this lesson objective, not generic filler.
Code Example
from dataclasses import dataclass
@dataclass
class ExperimentResult:
experiment: str
objective: str
score: float
notes: str
def choose_candidate(results: list[ExperimentResult]):
ranked = sorted(results, key=lambda item: item.score, reverse=True)
best = ranked[0]
return {
"winner": best.experiment,
"score": best.score,
"objective": best.objective,
"notes": best.notes,
}
candidates = [
ExperimentResult("baseline", "optimize inference latency", 0.74, "stable"),
ExperimentResult("feature_set_b", "optimize inference latency", 0.79, "better recall"),
ExperimentResult("regularized", "optimize inference latency", 0.77, "lower variance"),
]
print(choose_candidate(candidates))Commands & References
- python script.py
- df.describe()
- plt.plot()
Lab Steps
- Prepare environment using: python script.py
- Load a small sample dataset and validate schema.
- Run the core code workflow and collect metrics.
- Compare results and write one improvement note.
Exercises
- Change one hyperparameter and compare impact.
- Add one validation rule to reduce bad inputs.
- Document one failure mode and mitigation.