Skip to content
LearnPY

The capstone

One dataset. The whole stack.

Take wine chemistry measurements from a raw table to a plotted exploration, a scaled classification pipeline, and an evaluation that compares against a baseline. Seven cells, one shared Python session.

178 rows13 features3 cultivarsNo download

What you will produce

  • A cleaned pandas table with readable labels.
  • A class profile and a two-panel figure.
  • A scikit-learn pipeline evaluated on held-out rows against a majority-class baseline.
Open the reference
  1. 01pandas: load
  2. 02pandas: audit
  3. 03pandas: profile
  4. 04Matplotlib: explore
  5. 05scikit-learn: fit
  6. 06scikit-learn: evaluate
  7. 07stretch: compare

Cell 01

Load the table

Bring the wine measurements into pandas and keep the cultivar labels readable.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Cell 02

Audit the columns

Check types, missing values, and the scale of the chemical measurements.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Cell 03

Profile the classes

Compare group means before modeling. A feature that barely moves is not doing much work.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Cell 04

Look before modeling

Plot two candidate features and a distribution. Look for separation, overlap, and unusual points.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Cell 05

Split and fit a pipeline

Keep the test rows untouched. Scale inside the pipeline so the test set never informs preprocessing.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Cell 06

Evaluate honestly

Compare against a majority-class baseline, inspect per-class quality, and look at the confusion matrix.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Cell 07

Stretch: try another model

Optional. Swap the estimator and compare cross-validated accuracy. Change one thing at a time.

Not run
Loading editor…

Output

Run this cell to see its output. Cells share one Python session, so run them in order.

Before you call it done

Check the reasoning, not just the score.

  • Did the test set stay out of tuning and preprocessing?
  • Is the model better than the majority-class baseline?
  • Does the confusion matrix show a class the model struggles with?
  • Can you explain what each cell adds to the conclusion?