How to use from the
Use from the
Scikit-learn library
from huggingface_hub import hf_hub_download
import joblib
model = joblib.load(
	hf_hub_download("Marvinds/fraud-baseline-logreg", "sklearn_model.joblib")
)
# only load pickle files from sources you trust
# read more about it here https://skops.readthedocs.io/en/stable/persistence.html

fraud-baseline-logreg

A deliberately simple logistic-regression baseline for fraud detection, trained on Marvinds/synthetic-bank-transactions.

Why this project

Every later experiment I run (gradient boosting, sequence models, graph features) needs a number to beat. A baseline that's transparent, quick to retrain and honestly evaluated is that number. Logistic regression fits the job: its coefficients show what the model learned, and that can be checked against the known fraud mechanism of the synthetic dataset.

It also practises two habits from production fraud systems:

  • time-based evaluation (train on the past, test on the future), never a random split;
  • PR-AUC and recall at a fixed precision instead of accuracy, because accuracy is meaningless at a 0.6% fraud rate (predicting "never fraud" scores 99.4%).

Results

Time-based split: first 80% of transactions for training, last 20% (20,000 rows, 0.6% fraud) for testing.

Metric Value
ROC-AUC 0.9849
PR-AUC 0.7203
Recall @ precision β‰₯ 0.5 0.7355
Recall @ precision β‰₯ 0.8 0.6281

Strongest coefficients: txn_count_24h (+1.66) and amount_vs_avg (+1.61), which match the velocity and amount-spike pattern injected by the generator. Full list is in metrics.json.

These numbers come from synthetic data with a known generator. They show the pipeline works. They are not a claim about real-world fraud performance.

Features

log(amount), amount_vs_avg, txn_count_24h, is_foreign, is_new_device, is_night (00–04), plus one-hot merchant_category and channel. Standard-scaled, class_weight="balanced".

Usage

import hashlib, joblib, pandas as pd
from huggingface_hub import hf_hub_download

path = hf_hub_download("Marvinds/fraud-baseline-logreg", "model.joblib")
expected = open(hf_hub_download("Marvinds/fraud-baseline-logreg", "model.joblib.sha256")).read().strip()
assert hashlib.sha256(open(path, "rb").read()).hexdigest() == expected
model = joblib.load(path)  # pickle: only load files you trust

Input must have the feature columns listed above (see features() in train.py). Trained with scikit-learn 1.9.1.

Reproduce

uv run train.py --data path/to/transactions.csv --out model

Next experiments

  • HistGradientBoosting vs this baseline, same split
  • Probability calibration and threshold selection based on review-queue capacity
  • Performance under concept drift (dataset v2)
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train Marvinds/fraud-baseline-logreg

Space using Marvinds/fraud-baseline-logreg 1

Evaluation results

  • PR-AUC (time-based test split) on Synthetic Bank Transactions
    self-reported
    0.720
  • ROC-AUC (time-based test split) on Synthetic Bank Transactions
    self-reported
    0.985