Instructions to use Marvinds/fraud-baseline-logreg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Marvinds/fraud-baseline-logreg with Scikit-learn:
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 - Notebooks
- Google Colab
- Kaggle
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
- -
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 Transactionsself-reported0.720
- ROC-AUC (time-based test split) on Synthetic Bank Transactionsself-reported0.985
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