Overview
A machine learning project that predicts whether a credit card transaction is fraudulent. A Random Forest model is trained in a Jupyter notebook, serialized to disk, and served through a small Flask web app where transactions can be entered and scored in real time.
The system takes the details of a single transaction — transaction ID, hour of day, category, amount (USD), merchant, and job — and returns both a fraud probability and a binary fraud/legitimate prediction.
- Training (
train.ipynb): loads the dataset, encodes categorical features, and trains a Random Forest classifier, which is pickled to model.pkl.
- Serving (
server.py): a Flask API loads the pickled model and exposes a /predict endpoint plus a web dashboard.
- Frontend (
templates/index.html): a form-based dashboard that submits a transaction and displays the fraud probability and status.
Note: As a course project, the model's real-world applicability is limited by dataset quality (class imbalance and limited feature diversity). Future iterations should focus on richer, more representative data.