🏥 Healthcare AI · Explainable ML · Clinical Decision Support

AI-Powered Thyroid
Clinical Decision System

Built an interpretable machine learning classifier to assist clinical diagnosis of thyroid disorders, achieving 90% detection accuracy and a 40% improvement over previously used diagnostic methods.

XGBoost Random Forest KNN SMOTE scikit-learn Flask Docker AWS EC2
Deployed · Live on AWS EC2
Classification model live · Flask prediction API serving results · Explainable outputs for clinical review
90%
Detection Accuracy
0.9
ROC-AUC Score
+40%
Improvement vs Previous Methods
10%
Faster Diagnosis
3
Thyroid Disorder Classes Detected

🎯 Business Problem

Thyroid disorder diagnosis relied on manual clinical assessment of blood test results and patient symptoms, a process that was time-consuming, subjective, and prone to inconsistency between clinicians. Delayed or incorrect diagnosis leads directly to incorrect treatment plans, with real consequences for patient outcomes.

The goal was to build a reliable decision-support tool: a classification model that analyses patient diagnostic metrics, predicts the most likely thyroid condition, and provides explainable outputs, giving clinicians confidence in the recommendation rather than presenting a black-box result they could not validate.

🏗️ System Architecture

📋
Patient Data
Clinical Metrics
Blood Test Results
🐍
Preprocessing
SMOTE Balancing
Feature Selection
🧠
Classifier
XGBoost · RF
KNN
🔍
Explainability
Feature Importance
Contributing Factors
🌐
Flask API
Prediction Endpoint
Docker Container
☁️
AWS EC2
Production
Deployment
Output: Predicted thyroid condition · Confidence score · Key contributing clinical markers · Decision support summary for clinician review

⚙️ Key Technical Challenges & Solutions

CHALLENGE
Severe class imbalance: thyroid disorder subtypes were heavily underrepresented in the dataset, causing models to default to majority-class predictions and miss rare conditions.
SOLUTION
SMOTE (Synthetic Minority Oversampling) applied to balance class distribution, ensuring the model learned meaningful diagnostic patterns across all thyroid disorder types.
CHALLENGE
Clinical explainability requirement: doctors needed to understand why the model made a prediction, not just receive a label. A black-box output would not be trusted or acted upon.
SOLUTION
Feature importance surfaced in every output, the top contributing clinical markers are shown alongside each prediction, so clinicians can validate the reasoning before acting on it.
CHALLENGE
Model selection for clinical accuracy: KNN, Random Forest, and XGBoost all needed rigorous evaluation to identify the best performer with the lowest misclassification risk.
SOLUTION
Full head-to-head evaluation across all three algorithms, all achieved 90% accuracy and 0.9 ROC-AUC, validated across patient demographics and condition subtypes.
CHALLENGE
Clinical workflow integration: the tool needed to be accessible to clinical staff without requiring any technical expertise to operate day-to-day.
SOLUTION
Flask web interface with a simple patient data input form, clinicians enter diagnostic metrics and receive a prediction with contributing factors, deployed on AWS EC2 via Docker.

💡 What Makes This Different

Explainable AI for Clinical Use

  • Every prediction shows the top contributing clinical markers
  • Doctors validate the model's reasoning before acting on the result
  • Designed as a decision support tool, not a replacement for judgment

Robust Class Imbalance Handling

  • SMOTE applied to balance rare disorder subtypes during training
  • Consistent performance across all thyroid condition classes
  • Medically critical: avoids bias toward the majority class

Multi-Algorithm Validation

  • KNN, Random Forest, and XGBoost evaluated head-to-head
  • 90% accuracy and 0.9 ROC-AUC confirmed across all three algorithms
  • Robust performance validated across patient demographics and subtypes

Production-Ready Clinical Tool

  • Flask web interface deployable directly into clinical workflow
  • Dockerised and hosted on AWS EC2 for reliable uptime
  • Simple input form, no technical knowledge required to operate

🛠️ Technical Stack

🚀
XGBoost
Primary Classifier · Gradient Boosting
🌲
Random Forest
Ensemble Classifier · Feature Importance
🔍
KNN
K-Nearest Neighbour · Baseline Comparison
⚕️
SMOTE
Imbalanced-Learn · Class Balancing
🐍
scikit-learn · Python
ML Pipeline · Model Evaluation
🌐
Flask
Prediction API · Web Interface
🐳
Docker
Containerisation · Deployment
☁️
AWS EC2
Production Hosting · Model Serving

📈 Business Impact

📋 +40% Diagnostic Accuracy Improvement

  • 40% improvement over the manual clinical assessment methods previously used
  • Consistent accuracy maintained across patient demographics and condition subtypes
  • Reduces misclassification risk for rare thyroid disorder subtypes

⚡ 10% Faster Diagnosis

  • Analysis time reduced from manual review to near-instant model output
  • Earlier treatment decisions for time-sensitive or ambiguous cases
  • Reduces clinician cognitive load during high-volume periods

🏥 Enhanced Clinical Confidence

  • Explainable outputs let clinicians validate AI recommendations directly
  • Acts as a reliable second opinion alongside clinical judgment
  • Designed for adoption: transparent, not opaque
⚠️ Disclaimer: This project serves as a Proof of Concept demonstrating how machine learning is applied in practice. No proprietary client data is disclosed.