Releases: lfariabr/sommelier-api
Releases · lfariabr/sommelier-api
Release list
v0.1.1 — A2 v7 parity lock
A2 v7 parity lock
- Locks the served classifier to the submitted MLN601 Assessment 2 v7 contract.
- Validates dataset hashes, row counts, feature order, target semantics, split, parameters, exact metrics, and confusion matrix before writing artifacts.
- Adds exact fresh-retrain parity tests for predictions, probabilities, and internal tree arrays.
- Exposes the model contract and source submission commit through /health and /model/info.
- Keeps all existing prediction request and response contracts unchanged.
Verification: 26 tests passed; make parity passed 18 checks; ruff passed.
v0.1.0 — The leakage audit
Honest-metrics release. Auditing the same pipeline for MLN601 Assessment 2 surfaced 1,177 exact duplicate rows in the raw UCI files crossing the train/test split and inflating every published v0.0.1 metric.
Changed
- Dedup before split in
ml/train.py: 6,497 raw rows → 5,320 unique. Provenance (raw_rows,duplicates_removed) recorded inmetrics.jsonand served atGET /model/info. - Grade model is now the assessment-approved balanced tree:
DecisionTreeClassifier(gini, max_depth=5, min_samples_leaf=20, class_weight="balanced"). It trades some false alarms for catching 73% of genuinely low wines (was 59% at default weighting) — in a screening problem, the miss is the expensive error. - Honest re-trained metrics:
| Metric | v0.0.1 | v0.1.0 |
|---|---|---|
| Regression R² | 0.50 | 0.41 |
| Regression RMSE | 0.61 | 0.66 |
| Classification ROC-AUC | 0.81 | 0.79 |
| Classification sensitivity (low) | — | 0.73 |
| Classification specificity (high) | — | 0.73 |
The models did not get worse — the evaluation got corrected: v0.0.1 was graded partly on rows it had already seen.
metrics.jsonand/model/infonow include sensitivity, specificity, F1 and the full confusion matrix; the Streamlit model card and About page lead with them.- Tests re-pinned to the deduplicated numbers, plus a gate test mirroring the assessment approval criteria (AUC ≥ 0.75, sensitivity ≥ 0.70, specificity ≥ 0.70). 24 tests, ruff clean.
Live
- 🍷 App: https://sommelier-api.streamlit.app/
- 📜 API (Swagger): https://sommelier-api-yd1m.onrender.com/docs
v0.0.1 — First public release
The first end-to-end cut of sommelier-api: two ML models trained on the UCI Wine Quality dataset, served by a FastAPI backend and a Streamlit UI over one shared core — deployed, tested, and documented.
Models
- Score (regression):
RandomForestRegressor(n_estimators=400)→ predicted quality, R² 0.50 / MAE 0.44 / RMSE 0.61. - Grade (classification): tuned
DecisionTreeClassifier(max_depth=6, min_samples_leaf=20)→ high (≥6) / low (<6), accuracy 0.74 / ROC-AUC 0.81. - Re-trained deterministically (
random_state=42) from the public CSVs — bit-identical to source. Pinned scikit-learn 1.9.0.
What's in it
ml/core —features.py(single source of truth for the 12-feature contract),train.py(reproduces both models → joblib + schema + metrics),predict.py(shared inference + A2 label-inversion guard).- FastAPI —
GET /health/features/model/info;POST /predict/score/predict/grade/predict. Pydantic v2 validation, Swagger, real metrics from training. Deployed on Render. - Streamlit — tasting-room with quality gauge + high/low grade badge; local-default inference with automatic API fallback. Deployed on Streamlit Community Cloud.
- Quality & ops — 23 tests, GitHub Actions CI (ruff + pytest), Makefile, Dockerfile, render.yaml, pinned requirements.