Fraud detection on 284,807 card transactions

SQL (DuckDB) and Python (pandas, scikit-learn) · In progress, started September 2026

Status: in progress. This page says what exists today and what is next. No results are shown until there are real ones.

What it is

SQL first, then a model. The features will be per-card velocity measures written as window functions in DuckDB: transactions in the trailing hour and the trailing day, the amount against the card's rolling mean, and the time since the previous transaction. The train/test split will be by time, so nothing from the future leaks into training.

What exists today

The dataset is loaded: the ULB credit-card set from OpenML, 284,807 transactions with 492 frauds (0.17%). Around it is a scaffold that runs each SQL step in order, checks the feature table against a fixed contract before any model sees it, and computes the evaluation metrics in both R and Python, cross-checked to agree to 1e-9. The queries and the model are the part I write, and that is the part still in progress.

What is next

  1. Logistic regression and a gradient-boosted classifier, compared on precision-recall rather than accuracy.
  2. False-positive rate at a fixed recall, and calibration, since an alert that is wrong costs review time.
  3. An alert threshold set from a fixed daily review budget, and a daily monitoring view.
  4. A public repository when it is done.