100 beginner machine learning projects with runnable Python code, tests and honest case studies. By Networkers Home, Bangalore.
This small teaching project trains an interpretable baseline classifier for a binary medical diagnosis task using a licensed, de-identified teaching dataset included with scikit-learn. The goal is educational: demonstrate careful data handling (explicit missing-data treatment and patient-level separation), train a simple logistic regression baseline, and report clinically-relevant metrics (sensitivity, specificity) together with calibration and uncertainty estimates. The code is intentionally sandboxed and does not provide patient-specific diagnosis or treatment advice.
This project uses the scikit-learn breast cancer dataset (diagnostic Wisconsin). That dataset provides de-identified, per-patient numeric features and a binary target (malignant/benign). No external data are used and no patient identifiers are exposed.
Run the project module directly. It prints a JSON summary of metrics to stdout.
Run pytest in the project directory. Tests check that the run() function returns the expected keys, that numeric metrics are within valid ranges, that a conservative performance floor is met on the held-out split, and that results are deterministic for a fixed seed.
Measured by running python project.py (seed 42) on 2026-10-23; the tests in test_project.py assert the floor.
| Metric | Value |
|---|---|
| accuracy | 0.9650 |
| sensitivity | 0.9245 |
| specificity | 0.9889 |
| brier | 0.0215 |
| ece | 0.0323 |
| subgroup_sensitivity_diff | -0.0816 |
| model | LogisticRegression |
Also returned (see python project.py output): sensitivity_ci (2 items), specificity_ci (2 items).
This exercise is educational. Even though the dataset is a real, de-identified teaching dataset, retrospective performance on this dataset does not establish diagnostic safety or clinical benefit. The model is a simple logistic regression baseline and has had no clinical validation, prospective testing, nor assessment of harms. The pipeline also uses a single held-out test split; a full evaluation would include external validation, robust calibration assessment in new groups, and clinician review.
Suggested next steps for learning: (1) add nested cross-validation and repeated runs to better estimate uncertainty; (2) evaluate external datasets or temporal splits; (3) include clinician adjudication for any ambiguous labels; (4) explore simple explainability methods (feature coefficients, SHAP-lite analyses) and assess fairness across subgroups before considering any clinical translation.
Full case study, build steps and evaluation checks: Medical diagnosis classifier on networkershome.com
Built by Networkers Home · Learn the skills in the AI Engineer Course · Part of 100 AI projects with code