Part IV — Expert Production Engineering · Chapter 19 · Lesson 7 of 7 · 3 min read
Chapter 19 Checkpoint: Reproducible Classification Pipeline
Checkpoint level: Advanced
Goal. Build, evaluate, and package a customer-churn classifier as one reproducible, schema-checked pipeline with calibrated probabilities and a documented, cost-based decision policy. The result is the input to Chapter 20, which registers, signs, releases, and monitors it.
19C.1 Required pipeline
- Problem statement. Define the prediction moment, target, decision supported, and the costs of false positives and false negatives.
- Leakage review. List every candidate feature and confirm its availability at prediction time; remove any that fail.
- Split. Seeded, stratified, customer-grouped training and test sets; the test set is locked until the final evaluation.
- Preprocessing. Column transformer with median imputation and missing indicators, standardization, and one-hot encoding with an unknown bucket; unknown columns dropped.
- Models. A majority-class baseline, an unregularized logistic regression, and a regularized logistic regression tuned by cross-validated search.
- Calibration. Platt or isotonic calibration on cross-validated predictions, with a reliability table before and after.
- Decision policy. A cost-based threshold chosen on validation data, checked against a stated weekly capacity, with an optional abstain band.
- Packaging. The fitted pipeline, input schema, metadata, and artifact hash saved together.
19C.2 Evaluation requirements
- Cross-validated PR AUC, ROC AUC, recall, precision, log loss, and Brier score for every candidate, with fold standard deviations.
- One final test-set evaluation of the chosen pipeline, with 90% bootstrap intervals for recall, precision, and PR AUC.
- Expected cost at the chosen threshold compared with the 0.5 threshold and with contacting customers at random.
- Precision and recall by at least two segments, with any segment more than 10 percentage points below the overall recall flagged for review.
19C.3 Acceptance tests
- Rerunning the full training script with the recorded seed and data hash reproduces the golden predictions exactly (or within a documented tolerance).
- No customer appears in both training and test sets.
- Every fitted preprocessing step is fitted inside cross-validation folds (verified by a test that fails if preprocessing is fitted on validation rows).
- A batch with a missing column, an out-of-range value, and an unseen category is handled exactly as the schema policy specifies.
- The chosen model beats the majority-class baseline on PR AUC and on expected cost, and the improvement exceeds the bootstrap uncertainty.
- Calibration reduces or holds the Brier score and leaves ROC AUC within 0.005.
- The saved artifact reloads only when its hash matches, and its predictions equal the in-memory pipeline's predictions.
19C.4 Assessment rubric
| Area | Weight | Evidence of mastery |
|---|---|---|
| Problem framing and leakage control | 20% | Clear prediction moment; every feature justified; grouped split |
| Evaluation honesty | 25% | Folds respect groups; test set used once; uncertainty and baselines reported |
| Model quality and selection | 15% | Regularization tuned sensibly; simplest adequate model chosen |
| Probabilities and decisions | 15% | Calibration verified; threshold derived from costs and capacity |
| Packaging and reproducibility | 15% | Schema, metadata, hash, and rebuild test all present |
| Communication | 10% | A decision-maker can understand the model, its limits, and its policy |
Completion standard. All acceptance tests pass, the model card draft (problem, data, metrics, segments, limits, decision policy) is complete, and every illustrative API call has been confirmed against the module reference of your installed PeaLang version or replaced with its documented equivalent.
Reflection. Which choice changed the honest performance estimate the most: the split strategy, the leakage review, or the model? Which segment result would you raise with the business owner before a pilot?
Chapter summary. Supervised learning succeeds or fails on its foundations: a clearly framed prediction, leakage-free features, seeded and properly structured splits, preprocessing fitted only on training data, interpretable baselines, metrics tied to costs, cross-validated selection, calibrated probabilities, explicit decision policies, and a single reproducible pipeline that validates its inputs.
Transition to Chapter 20. A reproducible pipeline is ready to be governed. Chapter 20 begins with integrity-checked model bundles and registries, then adds lifecycle states, promotion, monitoring, drift and fairness diagnostics, model cards, and secure signing.
Checkpoint status: Ready for review.