BEGINNER • Data Exploration Basics
Modeling Sprint: optimize inference latency #2
This lesson focuses on optimize inference latency using a practical warehouse optimization model scenario. You will apply commands: pip install pandas numpy matplotlib seaborn | python script.py | df.describe(). 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
- pip install pandas numpy matplotlib seaborn
- python script.py
- df.describe()
Lab Steps
- Prepare environment using: pip install pandas numpy matplotlib seaborn
- Load a small sample dataset and validate schema.
- Run the core code workflow and collect metrics.
- Compare results and write one improvement note.