Skip to content
Raisalon

Traditional machine learning · Planned

Real-time fraud detection with explainable scores

A fraud classifier for highly imbalanced transaction data, with cost-based thresholds, per-prediction explanations, and a low-latency scoring API.

Planned project. This page describes the goal, the approach, and how the system will be evaluated. Code, a live demo, and results will be published here once it is built.

At a glance

Solo project: features, models, thresholds, and scoring API

Problem
Flag fraud in transaction data where fraud is under 1% of cases, and explain every flag to the analyst who acts on it.
Planned approach
Time-ordered splits, behavioural features without look-ahead, XGBoost against a logistic-regression baseline, and SHAP explanations per score.
Design decisions
  • The decision threshold is set from the cost of a missed fraud against an unnecessary review, not the default 0.5.
  • Class weights instead of blind oversampling, so the validation data keeps its real class balance.
Evaluation plan
Average precision, recall at a fixed review budget, an expected-cost curve, and p95 scoring latency.

Goal

Flag fraudulent transactions where fraud is well under 1% of the data, and make every flag explainable to the analyst who has to act on it. Accuracy is meaningless here: a model that never flags anything is over 99% accurate. The work is in choosing what to optimize and where to draw the line.

Planned approach

  1. Data. A public transaction dataset with realistic class imbalance, split by time so the model is tested on later transactions than it learned from.
  2. Features. Behavioural features such as spending velocity, deviation from a customer’s usual amounts, and time since the last transaction, computed without looking ahead in time.
  3. Modelling. Compare logistic regression with gradient-boosted trees (XGBoost), handling imbalance with class weights rather than blind oversampling.
  4. Thresholds. Set the decision threshold from the cost of each error, a missed fraud against an unnecessary review, instead of the default 0.5.
  5. Explanations. SHAP values returned with each score, so a reviewer sees which features drove the decision.
  6. Serving. A FastAPI scoring endpoint in Docker with a latency budget per request.

Evaluation plan

Definition of done

A public repository, a scoring API with explanations, a results table against a logistic-regression baseline, and a write-up of the threshold decision.

All projects