Adult Income Classifier
A deployed machine learning app that predicts whether an individual’s annual income exceeds $50,000 from UCI Adult census data — a Decision Tree model served by a FastAPI backend with a static web frontend.

Overview
A complete machine learning pipeline from data exploration to deployment. The ML phase, in a Jupyter notebook, covers exploratory analysis, cleaning, feature engineering, and training and comparing a Decision Tree and Naïve Bayes across five train/test splits. The production phase serves the trained model through a stateless FastAPI backend and a vanilla JavaScript frontend, both deployed on Vercel.
The problem
Predict whether an individual’s annual income exceeds $50,000 based on demographic and census-related attributes (UCI Adult dataset: 48,842 records, 14 attributes).
Objectives
- Compare Decision Tree and Naïve Bayes classifiers across five train/test splits (50:50 to 90:10)
- Engineer and preprocess census features faithfully for both training and inference
- Deploy the best model as a fast, stateless prediction API with a web interface
Features
- Instant predictions (sub-100 ms responses)
- REST API with OpenAPI/Swagger documentation
- Web form whose options are loaded from the API’s /schema endpoint, so they always match the model
- Preprocessing caps, encodings and column order read from the trained model artifact
- Pydantic input validation, logged server errors and a pytest suite
Architecture & implementation
FastAPI (Uvicorn) backend loading a ~30 KB scikit-learn artifact (fitted ColumnTransformer + Decision Tree + metadata) and a static HTML/CSS/JavaScript frontend, deployed as two Vercel projects from one repository. The Decision Tree uses max_depth=8 and class_weight="balanced", trained on the 90:10 split. Preprocessing: mode imputation for missing values, winsorisation of capital gain/loss at the 99th percentile, MinMax scaling of continuous features, label and one-hot encoding (41 model inputs).
My contribution
Group project for CCS23213 Data Mining at Albukhary International University, supervised by Dr. Mohamad Farhan Mohamad Mohsin, with Anas Muhammad Sani Lawal and Zikrullah Faizan.
Outcomes & evaluation
On the 90:10 test split the Decision Tree reached accuracy 0.8149, precision 0.5778, recall 0.8425 and F1 0.6855 for the >50K class, outperforming Naïve Bayes (accuracy 0.7206, F1 0.6080).
Lessons learned
- Computing winsorisation caps and duplicate removal before the train/test split causes mild data leakage, so reported metrics may be slightly optimistic
- Class balancing raised recall for the >50K class (0.84) at the cost of precision (0.58)
- The data comes from the 1994 US Census, so patterns may not reflect today’s incomes
- Sex is a model input and predictions reflect historical patterns, so this is an educational project, not a tool for decisions about people
Continue reading
AI / Machine Learning
ThreatLens AI — Explainable Phishing URL Detection
A web application that classifies a submitted URL as likely benign, suspicious or high risk with a trained machine-learning model, explains exactly why, and gives proportionate safety guidance — without ever contacting the destination website.
Case studyAI / Machine Learning
Student Performance Prediction
A Linear Regression model on a 1,000-record dataset achieving R² = 0.8875 and MAE = 4.07, benchmarked against a tuned Random Forest (R² = 0.860).
Case study