File size: 11,834 Bytes
e9a38a9
 
 
 
 
 
8afd7a4
e9a38a9
 
 
 
 
 
 
8afd7a4
e9a38a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# 🏦 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.*