A single-lesson intro to machine learning in Python. We build a text sentiment
classifier with scikit-learn, then hand the notebook to a coding agent (Codex
or Claude Code) to extend it.
| Notebook | Task | Format |
|---|---|---|
notebooks/01_sentiment_analysis_beer.ipynb |
Beer review sentiment (3-class) | Manual build + two agent demos |
notebooks/02_nli_exercise.ipynb |
Natural language inference (binary) | Exercise |
notebooks/03_sentiment_analysis_wine.ipynb |
Wine review sentiment (3-class) | Exercise |
Slides: slides/Tutorial1_Slides-ML_in_Python.pdf
Download a notebook and open it in Google Colab
(File → Upload notebook), or run it locally with Jupyter. Each notebook downloads
its own data with wget, so nothing else needs to be set up.
For local runs: pip install -r requirements.txt.
- Manually build a bag-of-words sentiment classifier (load → inspect → naive baseline → features → models → interpret).
- Agent demo A — ask the agent to plot learning curves that show overfitting.
- Agent demo B — ask the agent to iteratively improve the model (an "auto-research" loop) without touching the test set.
The NLI and wine notebooks are exercises that reuse the same workflow.
For the agent demos: once the manual part is done, download the notebook and drop it into a desktop agent session (e.g. the Claude or ChatGPT desktop app), then paste the prompts from the notebook — first Part A, then Part B. The agent runs the code and the plots come back as artifacts in the app.
data/beer/— beer reviews, 3-class (20k / 5k / 5k).data/nli/— MNLI subset, binary entailment vs. contradiction.data/wine/— Wine Enthusiast reviews, 80–100 points bucketed to 3 classes (20k / 5k / 5k). Seedata/wine/README.mdfor provenance.