Skip to content
← All projects

Diabetes Predictor

July 2023

Diabetes Predictor

About

Course project for Artificial Intelligence at Shiraz University (July 2023), built with AmirHossein Roodaki. The assignment required implementing logistic regression without a machine-learning library; scikit-learn is used only for the train/test split, the metrics and a sanity-check comparison.

The model

  • Features are standardised with statistics computed on the training split only.
  • Prediction is sigmoid(X @ w + b) with a numerically stable sigmoid; the loss is mean binary cross-entropy.
  • Training is full-batch gradient descent for 3000 steps at learning rate 0.1, with a fixed seed so it is deterministic.
  • A small PyQt5 desktop form loads the saved weights, validates the eight inputs and shows the estimated probability.

Results

Stratified 80/20 split on the 768-row dataset:

MetricFrom scratchscikit-learn
Accuracy0.7140.714
Precision0.6090.609
Recall0.5190.519
ROC-AUC0.8240.823

The learned weights agree with scikit-learn to about two decimal places. Glucose and BMI carry the largest positive weights.

This is an educational demo on a tiny dataset, not medical advice.

Tech Stack

  • Python
  • NumPy
  • scikit-learn
  • PyQt5