Abdulmajeedyahya's picture
Update README.md
e9a38a9 verified
|
Raw
History Blame Contribute Delete
11.8 kB
# 🏦 BankShield-2M: Synthetic Banking & Fraud Detection Dataset
> **2,000,000 records · 5 relational tables · 64 features · Multi-country · Analyst-labeled**
>
> **[⬇ Get the Full Dataset →](https://synthox.gumroad.com/l/jsyco)**
---
## Why This Dataset Exists
Every serious fraud-detection, credit-risk, or behavioral-analytics model eventually hits the same wall: **real banking data is locked behind NDAs, GDPR constraints, and institutional gatekeepers**. Public alternatives are either too small, too narrow, or stripped of the relational structure that makes real-world models actually work.
BankShield-2M was engineered to close that gap — a fully synthetic, privacy-safe dataset that mirrors the statistical properties, relational schema, and domain complexity of a real retail bank operating at scale.
---
## Dataset at a Glance
| Table | Full Dataset | Sample | Key Features |
|---|---|---|---|
| `transactions` | 2,000,000 | 5,000 | 12 cols, fraud labels, geo, device, merchant |
| `customers` | 50,000 | 2,500 | 16 cols, PII-safe, credit score, income, risk tier |
| `accounts` | 75,000 | 3,750 | 11 cols, IBAN, multi-currency, balance, credit limit |
| `fraud_alerts` | 22,000 | 1,100 | 9 cols, risk score, analyst notes, alert lifecycle |
| `devices` | 35,000 | 1,750 | 10 cols, fingerprint, OS, browser, trust status |
| **Total** | **2,182,000** | **14,100** | **58 features** |
---
## Schema & Relational Structure
```
customers (customer_id PK)
├──< accounts (account_id PK, customer_id FK)
│ │
│ └──< transactions (transaction_id PK, account_id FK)
│ │
│ └──< fraud_alerts (alert_id PK, transaction_id FK)
└──< devices (device_id PK, customer_id FK)
```
**Full referential integrity across all five tables.** Every `account_id` in transactions traces back to a `customer_id`; every `transaction_id` in alerts traces back to a flagged transaction. This is the graph structure that production fraud systems actually operate on.
---
## Feature Deep-Dive
### `transactions.csv` — The Core Signal Table
```
transaction_id │ UUID, unique per event
account_id │ FK → accounts
transaction_date │ ISO 8601 with milliseconds (2021–2024)
merchant_name │ 50+ real-world merchants (Walmart, Apple, Texaco…)
merchant_category │ 11 categories: ONLINE_RETAIL, GROCERY, RESTAURANT,
│ GAS_STATION, TRAVEL, ENTERTAINMENT, ATM_WITHDRAWAL,
│ HEALTHCARE, UTILITY, WIRE_TRANSFER, OTHER
amount_usd │ $0.67 – $49,622.28 (median $58, p95 $640)
transaction_type │ DEBIT / CREDIT / TRANSFER / REVERSAL
location_city │ Real city names across 10+ countries
location_country │ US(35%), GB(18%), DE(15%), AE(10%), ES/FR/NL/IT…
device_type │ MOBILE_APP(41%), POS_TERMINAL(30%), WEB_BROWSER(21%),
│ ATM(7%), PHONE(1%)
ip_address │ Unique IPv4 per transaction
is_fraud │ Binary label — 0.84% positive rate (realistic imbalance)
```
**Why it matters:** The class imbalance of 0.84% is not arbitrary — it mirrors the empirical 0.5–1.5% fraud rate documented across major card networks. Models trained on artificially balanced datasets fail in production; this one won't.
---
### `fraud_alerts.csv` — The Intelligence Layer
```
alert_id │ UUID
transaction_id │ FK → transactions
alert_timestamp │ When the alert was generated
alert_type │ GEO_ANOMALY(30%), ML_MODEL_FLAG(19%),
│ AMOUNT_ANOMALY(18%), VELOCITY_CHECK(15%),
│ BEHAVIORAL_ANOMALY(11%), DEVICE_FINGERPRINT(8%)
risk_score │ Continuous [0.102 – 0.989], mean=0.722
alert_status │ CONFIRMED_FRAUD(42%), RESOLVED(21%),
│ INVESTIGATING(14%), FALSE_POSITIVE(12%), NEW(10%)
analyst_notes │ Free-text investigation notes (NLP-ready)
resolution_timestamp │ SLA-trackable, NULL for unresolved cases
confirmed_fraud │ Final binary label — 77.4% confirmation rate
```
**Why it matters:** Six alert types encode the real taxonomy of financial fraud detection — geographic impossibility, behavioral deviation, device compromise, velocity abuse, and ML-model flagging. The analyst notes column is a rare NLP training signal for financial domain adaptation.
---
### `customers.csv` — The Identity Graph
```
customer_id │ UUID
full_name │ Internationalized (UK, US, DE, AE, FR, NL names)
date_of_birth │ Full age distribution
gender │ M / F / Non-binary
national_id │ Format-correct per country (SSN, NIN, UAE ID…)
email │ Realistic domain distribution
phone │ E.164 international format
address/city/zip │ Country-coherent (UK postcodes, US ZIPs, DE PLZs)
country │ US(39%), GB(20%), DE(15%), AE(11%), CH/IT/NL/FR…
credit_score │ FICO-range [300–850], mean=679, std=90
income_annual_usd │ [$12K – $689K], realistic skew
customer_since │ 2010–2023 — enables customer lifetime features
risk_tier │ HIGH(36%), LOW(26%), MEDIUM(23%), VERY_HIGH(14%)
is_fraud_suspect │ 2.68% flagged — enables customer-level fraud scoring
```
---
### `accounts.csv` — The Financial Ledger
```
account_id │ UUID
customer_id │ FK → customers (up to 3 accounts per customer)
account_type │ CHECKING(44%), SAVINGS(30%), CREDIT(20%), BUSINESS(5%)
account_number │ 10-digit synthetic number
iban │ Format-valid IBANs for GB, DE, US, AE
currency │ USD(40%), EUR(24%), GBP(21%), AED(10%), CHF(3%)
opened_date │ Account age signal
balance │ [-$63K – $1.44M] (negative balances included)
credit_limit │ Present only for CREDIT accounts [$517 – $74K]
status │ ACTIVE(88%), SUSPENDED(7%), CLOSED(5%)
is_flagged │ 2.9% — account-level risk signal
```
---
### `devices.csv` — The Trust & Telemetry Layer
```
device_id │ UUID
customer_id │ FK → customers
device_fingerprint │ MD5-format hash — unique per device
device_type │ MOBILE(55%), DESKTOP(35%), TABLET(10%)
os │ iOS(36%), Android(29%), Windows(20%), macOS(11%), Linux(4%)
browser │ App(38%), Chrome(32%), Safari(18%), Firefox(6%), Edge(6%)
first_seen │ Device registration date
last_seen │ Last activity date — enables recency features
is_trusted │ 75.7% trusted baseline
is_fraud_device │ 3.8% compromise rate
```
---
## What You Can Build
### Supervised Learning — Fraud Detection
- Binary classifier on `is_fraud` with full feature engineering across all 5 tables
- Multi-label classification (alert type prediction)
- Probability calibration benchmarking under real class imbalance (0.84%)
### Risk Scoring & Regression
- Customer-level risk score modeling using `credit_score`, `income_annual_usd`, `risk_tier`, transaction history
- Account-level default probability from `balance`, `credit_limit`, `status`, `is_flagged`
### Anomaly Detection (Unsupervised)
- Isolation Forest / Autoencoder baselines on transaction patterns
- Device trust scoring from behavioral telemetry
- Geographic impossibility detection from `location_city/country` + `ip_address`
### Graph Neural Networks
- Heterogeneous graph: customer → account → transaction → alert
- Fraud ring detection via shared device fingerprints or IPs
- Link prediction: which accounts belong to the same fraud ring?
### NLP / LLM Fine-Tuning
- Analyst notes as training signal for financial-domain LLMs
- Named entity recognition on merchant names
- Text classification of `analyst_notes``alert_type`
### Time-Series Analysis
- Transaction velocity features (hourly/daily aggregations)
- Customer behavioral drift detection over 2021–2024
- Seasonal fraud pattern analysis
### Multi-Task Learning
- Simultaneous prediction of `is_fraud`, `risk_score`, and `alert_type`
- Joint customer + account + transaction risk models
### MLOps & Benchmark Infrastructure
- Reproducible train/val/test splits with temporal holdout
- Class-imbalance benchmarking: SMOTE, focal loss, class-weighted XGBoost
- Model performance baselines on a scale unavailable in public datasets
---
## Statistical Properties
### Realistic Class Distribution
| Signal | Positive Rate | Notes |
|---|---|---|
| `transactions.is_fraud` | 0.84% | Matches real-world card fraud rates |
| `fraud_alerts.confirmed_fraud` | 77.4% | High-quality alert pipeline |
| `customers.is_fraud_suspect` | 2.68% | Customer-level exposure |
| `accounts.is_flagged` | 2.93% | Account-level risk |
| `devices.is_fraud_device` | 3.83% | Compromised device rate |
### Geographic Realism
| Country | Customers | Primary Currency |
|---|---|---|
| United States | 39% | USD |
| United Kingdom | 20% | GBP |
| Germany | 15% | EUR |
| UAE | 11% | AED |
| Switzerland, Italy, Netherlands, France | 15% combined | CHF / EUR |
### Temporal Coverage
- **Transaction window:** January 2021 – June 2024 (3.5 years)
- **Customer tenure:** 2010–2023 (14-year range for long-term behavioral modeling)
- **Alert resolution SLA:** Computable from `alert_timestamp``resolution_timestamp` (27% unresolved — mirrors real investigation queues)
---
## Data Quality Notes
| Table | Known Nulls | Notes |
|---|---|---|
| `transactions` | 0.38% in `transaction_date` | Realistic ETL artifacts |
| `fraud_alerts` | 24.5% in `resolution_timestamp` | Unresolved/open investigations |
| `accounts` | 79.8% in `credit_limit` | NULL only for non-CREDIT accounts |
| `customers` | 0 | Complete |
| `devices` | 0 | Complete |
Nulls are **by design**, not data corruption. `credit_limit` is NULL for CHECKING/SAVINGS/BUSINESS accounts because it is inapplicable. Unresolved `resolution_timestamp` values represent active investigation cases — a feature, not a bug.
---
## Comparison to Existing Public Datasets
| Dataset | Records | Tables | Fraud Labels | Relational | Multi-Country | Analyst Notes |
|---|---|---|---|---|---|---|
| **BankShield-2M** | **2M+** | **5** | **✅ Multi-level** | **✅ Full FK** | **✅ 10+ countries** | **✅ Yes** |
| IEEE-CIS Fraud 2019 | 590K | 2 | ✅ | ❌ | ❌ | ❌ |
| PaySim | 6.3M | 1 | ✅ | ❌ | ❌ | ❌ |
| Credit Card Fraud (Kaggle) | 284K | 1 | ✅ | ❌ | ❌ | ❌ |
| BankSim | 594K | 1 | ✅ | ❌ | ❌ | ❌ |
---
## License & Usage
- **Fully synthetic** — no real individuals, no PII, GDPR/CCPA compliant
- **Commercial use permitted** under the dataset license
- Suitable for academic research, ML product development, FinTech prototyping, red-team simulation, and fraud analytics education
---
## Get the Full 2-Million-Record Dataset
The files in this repository are a **0.25% sample** of the complete dataset.
The full release includes:
- `transactions.csv` — 2,000,000 rows
- `customers.csv` — 50,000 rows
- `accounts.csv` — 75,000 rows
- `fraud_alerts.csv` — 22,000 rows
- `devices.csv` — 35,000 rows
- Data dictionary (`schema.md`)
- Suggested train/val/test split methodology
**[⬇ Purchase on Gumroad →](https://synthox.gumroad.com/l/jsyco)**
---
## Citation
If you use this dataset in academic work:
```bibtex
@dataset{BankShield2m_2024,
title = {BankShield-2M: Synthetic Banking and Fraud Detection Dataset},
year = {2024},
publisher = {Synthox},
url = {https://synthox.gumroad.com/l/jsyco}
}
```
---
*Dataset generated and maintained by [Synthox](https://synthox.gumroad.com). For questions, feature requests, or bulk licensing, contact via Gumroad.*