All projects
Course project

Breast Cancer Diagnosis

A fuzzy logic system that flags tumours as benign or malignant: 94.6% accurate on 569 cases, tuned to miss as few cancers as possible.

Role
Solo: rules, code and evaluation
Team
Just me
When
2026, rebuilt November 2026
Stack
  • Python
  • NumPy
  • pandas
  • Matplotlib
  • scikit-learn

The problem

An AI Techniques course project: tell a benign breast tumour from a malignant one using three cell-nucleus measurements, with fuzzy logic so every verdict traces back to rules a person can read. It began on a different dataset whose labels turned out to be unrelated to its inputs. Logistic regression, random forest and gradient boosting all scored 33 to 40%, no better than guessing, so I rebuilt it on the Breast Cancer Wisconsin data.

What I built

A Mamdani fuzzy inference system written from scratch in Python. Worst radius, concave points and texture are each fuzzified into Low, Medium and High. 27 IF–THEN rules cover every combination, and the clipped outputs are combined and defuzzified by centroid into a malignancy score from 0 to 100. The script walks five cases through every step, then reports accuracy, sensitivity and a confusion matrix.

Miss as few cancers as possible

The break points sit where benign and malignant values start to overlap, and a score of 50 or more counts as malignant. Across all 569 cases that gives 98.6% sensitivity, missing 3 of 212 malignant tumours, at the cost of sending some benign ones for a second look. For screening, that is the trade-off you want.

Screens

Membership functions for the three inputs and the score
Membership functions for the three inputs and the score
A borderline case: the centroid lands at 52.3, so this benign tumour is flagged for a second look
A borderline case: the centroid lands at 52.3, so this benign tumour is flagged for a second look
The held-out test set: no malignant tumour missed
The held-out test set: no malignant tumour missed
Next projectUnifydBudgets, deadlines and receipt scanning in one app for Malaysian university students.