Diabetes Predictor
July 2023
- Machine Learning
- Logistic Regression
- NumPy

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:
| Metric | From scratch | scikit-learn |
|---|---|---|
| Accuracy | 0.714 | 0.714 |
| Precision | 0.609 | 0.609 |
| Recall | 0.519 | 0.519 |
| ROC-AUC | 0.824 | 0.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.