learntodriveai.dev/Data Science/Classification and Imbalanced Evaluation
Data ScienceProject 046 unitsVerified on 16 October 2026

Classification and Imbalanced Evaluation

Luciana MorettiOwner and Winemaker · Family winery · Mendoza, Argentina
Voicemail · from Luciana
Not to replace my tasting — I will always taste — but so I can focus my time on the borderline cases instead of tasting through barrels that are obviously standard.
Chat with Luciana

What you hand back

  • A Reserve-versus-Standard classification model
  • Precision and recall at a tuned threshold
  • A methodology memo with limitations
  • Production factors explained in vineyard terms
  • A findings summary for the winemaker
  • A decision record for the key choice

6 units

  1. Unit 1: The voicemail and the data

    Set up the project, read the voicemail, ask which mistake costs more, and profile the barrel data.

    Open unit 1
  2. Unit 2: Clean and prepare for classification

    Clean the barrel data, remove a column derived from the panel score, encode categories, and define Reserve.

    Open unit 2
  3. Unit 3: The accuracy trap

    Fit a baseline model, find that its high accuracy hides missed Reserve barrels, then measure precision and recall.

    Open unit 3
  4. Unit 4: Better models and honest comparison

    Compare a decision tree with logistic regression, read ROC curves, and tune the threshold toward catching Reserve.

    Open unit 4
  5. Unit 5: Cross-check and translate for Luciana

    Finish the methodology memo, have a second session review it, and translate results into barrels and production terms.

    Open unit 5
  6. Unit 6: Deliver and close

    Send the findings, handle her follow-up about predicting actual scores, write a decision record, and push the work.

    Open unit 6
Read the full brief

Reserve barrels sell for four times the price of standard, and the winemaker at a family winery in Mendoza, Argentina tastes hundreds of samples by hand to find them. You build a classification model that predicts which samples are likely to clear the Reserve bar, so she can spend her tasting time on the borderline cases.

The discipline skills: building logistic regression and decision tree classifiers with scikit-learn, evaluating with precision, recall, confusion matrices, and ROC curves, tuning a classification threshold to match the client's cost priorities, and catching proxy features that give the model the answer.

The AI-direction lesson: AI defaults to accuracy as the evaluation metric. On this data, where only about 8% of barrels make Reserve, a model that never predicts Reserve achieves 92% accuracy and catches nothing. The skill is recognizing when AI's default metric is meaningless -- and this is the clearest example you have encountered so far. The number looks right. The metric is wrong. Once you see this pattern, you start checking AI's metric choice before interpreting its results.

Your Role

You evaluate the model honestly -- not with a single accuracy number, but with metrics that show exactly what the model catches, what it misses, and what it falsely flags. The scaffolding is the same as last time. What changes is the terrain: classification on imbalanced data requires different evaluation from everything you have done before.

What's New

Last time, you combined three datasets, ran inferential analysis with assumption checking, and built a prediction model with regularization. You learned to verify through cross-model review and to communicate with effect sizes.

This time, the data is a single source — no joining work. But only about 8% of barrels make Reserve. That imbalance changes everything about how you evaluate a model. A model that never predicts Reserve achieves 92% accuracy and catches nothing. The metrics that worked for regression do not apply here. Precision, recall, confusion matrices, and ROC curves replace RMSE and R-squared.

The hard part is not building the model. It is figuring out whether the model actually does what Luciana needs — and that question depends on which errors she can live with.

Tools

  • Python 3.11+ via your conda "ds" environment
  • Jupyter Notebook for the analysis
  • pandas for data handling
  • scikit-learn for classification models, confusion matrices, ROC curves, and precision/recall
  • scipy for statistical checks
  • matplotlib / seaborn for visualization
  • Claude Code as the AI you direct
  • Git / GitHub for version control

Materials

You receive:

  • A barrel production dataset with five years of production data and quality scores
  • A data dictionary explaining each column
  • A methodology memo template to fill in as you work
  • A project governance file (CLAUDE.md) for Claude Code
  • Luciana's voicemail explaining what she needs

Same scaffolding as last time: templates, verification guidance, cross-model review. No provided answer key.

Materials · 6 files
Start Project 4

You work at a computer with a terminal. Signed in, your place is saved.