Index

Fraud Prediction Model

A small web app that scores a credit-card transaction for fraud, using a logistic regression model trained on a public Kaggle dataset.

Built with
Python, FastAPI, scikit-learn, pandas
Source
GitHub

Overview

The model is trained on the Kaggle credit-card fraud dataset, where fraudulent transactions are a tiny fraction of the total. A FastAPI app wraps it with a simple page for checking a transaction.

Worth noting

  • Built for imbalance

    Class weights are balanced and the split is stratified, so the rare fraud cases are represented in both training and test data.

  • The threshold is a choice

    The training script reports precision and recall at several thresholds instead of accepting the default of 0.5. The chosen value lives in configuration.

  • Same preprocessing in training and serving

    The fitted scaler is saved beside the model and reused by the app, so a transaction is scaled the same way it was during training.

Limits

Logistic regression is a baseline. It was chosen to learn the problem end to end, not to compete with production fraud systems.