Skip to content
KavinKrish
← All workCase study 02 / 06Machine learning project

GlucoSense

Diabetes risk screening from 21 questions, before any blood test.

Year
2026
Role
Modelling, API and interface
Stack
PythonNumPyFastAPIPlotly.js
GlucoSense
GlucoSense: Landing page
253,680People in the training data
0.807ROC AUC on unseen people
79.4%Real cases caught
0ML libraries in the model

01 — The problem

A screener that turns 21 simple health questions into a calibrated diabetes risk, a clear test-or-not recommendation and the reasons behind it. The model is written from scratch in NumPy.

India had about 101 million adults with diabetes and another 136 million with prediabetes in 2021 (ICMR-INDIAB, The Lancet Diabetes & Endocrinology, 2023). Prediabetes is silent and often reversible, but only if it's caught.

Blood tests don't scale to everyone, so health workers triage with questionnaires first. GlucoSense is that questionnaire, with an honest probability and an explanation instead of a bare score.

02 — What it does

01

Calibrated risk

A live gauge that updates as you answer. When it says 20%, about 20 in 100 people like you have diabetes.

02

Test recommendation

Get a blood test or not, at a sensitivity you choose, from catching half of cases to catching 95%.

03

The evidence

Every answer is shown as an odds multiplier, so you can see what pushes your risk up or down.

04

Labs

A Bayes lab, a distributions lab, live curve fitting and a page explaining all 32 training charts.

03 — How it works

  1. 1

    A Naive Bayes classifier written from scratch: Bernoulli and categorical likelihoods learned by counting with Laplace smoothing, and a log-normal density for BMI. Everything runs in log space.

  2. 2

    Raw Naive Bayes scores are overconfident, so they're calibrated with 30 equal-count bins and pool-adjacent-violators. Log-loss drops from 0.512 to 0.327 with the ranking untouched.

  3. 3

    The decision threshold is the highest score that still catches at least 80% of real cases on validation data, because a missed case costs far more than an extra test.

  4. 4

    A regularised polynomial fit draws the population risk curve against BMI. The full training pipeline runs in about 30 seconds on a laptop CPU.

04 — Results

  • Measured once, on 38,052 people the model never saw: ROC AUC 0.807 (5-fold CV 0.811 ± 0.003), 79.4% recall and precision at twice the base rate.
  • 17 automated tests, with scikit-learn used only as a reference to check the from-scratch maths.

In pictures

5 screens
GlucoSense: The 21-question screener
02 · The 21-question screener
GlucoSense: Bayes lab
03 · Bayes lab
GlucoSense: Test-set report
04 · Test-set report
GlucoSense: Live curve fitting
05 · Live curve fitting
GlucoSense: Training graphs, explained
06 · Training graphs, explained
Next project

RainCheck

Parametric income insurance for India's food-delivery riders.

TRIGGER · 64 MM₹650 PAID