Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

The general classification recipe

Use when: you have a labeled dataset and need to predict a discrete category

Goal: a tuned, honestly evaluated classification model with a documented baseline comparison

Taught in Which algorithm should I use?

  1. 1

    Write down exactly what one sample is. Write down exactly what the target label means in practice. Note which features are safe, and which count as leakage.

    Why: this choice quietly decides the split, the metric, and the imbalance plan. Every later step depends on it.

  2. 2

    Compute the majority-class accuracy first, or fit a plain, untuned logistic regression. Do this before touching anything more complex.

    Why: without this step, no later score has an honest reference point.

  3. 3

    Fit a regularized logistic regression, a random forest, and a gradient-boosted model. Run all three through the identical Pipeline and CV setup.

    Why: different model families capture different structure. It's rarely obvious ahead of time which one this problem rewards.

  4. 4

    Compare candidates by cross-validated precision, recall, F1, or ROC-AUC. Pick the metric based on the real cost of a false positive versus a false negative. Decide this before seeing any results.

    Why: accuracy alone is often misleading under class imbalance. Picking the metric after seeing results is a form of over-tuning.

  5. 5

    Apply random search first, then refine with Bayesian optimization via Optuna. Do both only on the single strongest candidate from the last step.

    Why: tuning time is short, and spending it on an already-weaker candidate rarely closes a real gap.

  6. 6

    Check feature importance or SHAP values as a final leakage sanity check. Then save the entire fitted Pipeline, not the bare model alone.

    Why: saving only the model risks a preprocessing mismatch at inference time.

Common mistakes

  • Skipping the baseline, and reporting a raw accuracy number with nothing to compare it to.
  • Sticking with one model family before trying at least one other option.
  • Picking the metric after seeing which one flatters the favorite model.