100 beginner machine learning projects with runnable Python code, tests and honest case studies. By Networkers Home, Bangalore.
This small teaching project trains and evaluates an image classifier for handwritten characters using the scikit-learn digits dataset (8x8 images of handwritten digits 0–9). It demonstrates a reproducible training pipeline with a documented character vocabulary, a pseudo “cross-writer” split when writer identifiers are not available, and an editable suggestion-style output that provides top candidate characters and an “Unknown” fallback when the model is uncertain.
The project uses the built-in sklearn.datasets.load_digits dataset (8x8 grayscale images of digits 0–9). The dataset does not include writer identifiers, so the code simulates writer groups deterministically from image statistics to demonstrate a group-based split that approximates cross-writer evaluation. This is a compromise for the classroom exercise; for real cross-writer validation use a dataset that contains explicit writer IDs.
Run: python project.py The script prints a JSON object of metrics and a small preview of suggestions for held-out samples.
Run pytest in the project directory: pytest -q Tests assert presence of expected metrics, ranges, determinism, and a conservative accuracy floor.
Measured by running python project.py (seed 42) on 2026-10-23; the tests in test_project.py assert the floor.
| Metric | Value |
|---|---|
| dataset | sklearn_digits_8x8 |
| n_train | 1365 |
| n_test | 432 |
| accuracy | 0.9676 |
| top3_accuracy | 1 |
| per_class_accuracy_mean | 0.9693 |
| unknown_fraction | 0.0139 |
Also returned (see python project.py output): vocabulary (10 items), suggestions_preview (10 items).
Read the
top3_accuracyvalue with care: the data here is small and synthetic with a planted, learnable structure, so a near-perfect score shows the pipeline works, not that the method would reach this on real data. See Limitations.
Full case study, build steps and evaluation checks: Handwriting recognition system on networkershome.com
Built by Networkers Home · Learn the skills in the AI Engineer Course · Part of 100 AI projects with code