DoDataThings commited on
Commit
c899fdf
·
verified ·
1 Parent(s): c60ce79

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +73 -57
README.md CHANGED
@@ -16,25 +16,22 @@ size_categories:
16
 
17
  # US Bank Transaction Categories v2 — Synthetic Dataset
18
 
19
- **Successor to [v1](https://huggingface.co/datasets/DoDataThings/us-bank-transaction-categories).** 24,000 sign-prefixed transaction descriptions with expanded merchant coverage, PayPal wrapper patterns, and a refined 16-category taxonomy.
20
 
21
- ## What Changed from v1
22
 
23
- | | v1 | v2 |
24
- |---|---|---|
25
- | **Format** | `description, category` | `[debit]/[credit] description, category` |
26
- | **Categories** | 16 (includes Housing) | 16 (Housing split into Rent + Mortgage removed) |
27
- | **Samples** | 16,000 (1,000/category) | 24,000 (1,500/category) |
28
- | **Merchants** | ~300 | ~500+ |
29
- | **PayPal wrappers** | Few categories | All spending categories (8% of samples) |
30
- | **POS prefixes** | SQ* | SQ*, TST* (Toast), CLV* (Clover) |
31
- | **Transfer patterns** | Basic P2P + CC payments | + brokerage sweeps, fintech, wire, cashier's checks, ATM, crypto, BNPL |
32
 
33
- ## Why Sign Prefixes?
34
 
35
- v1 couldn't distinguish Income from Transfer because the description alone is ambiguous. "VENMO CASHOUT" as a credit (money arriving) is Income. As a debit (money leaving) it's Transfer. The `[debit]`/`[credit]` prefix encodes the transaction direction from the cardholder's perspective.
36
 
37
- Sign distributions per category reflect real-world patterns — spending categories are 95%+ debit, Income is 97% credit, Transfer is 50/50.
 
 
 
38
 
39
  ## Format
40
 
@@ -43,44 +40,62 @@ CSV with two columns:
43
  ```
44
  description,category
45
  "[debit] AMAZON MKTPL*K8R2M5VN7","Shopping"
46
- "[credit] Zelle payment from JAMES GARCIA COFZ4RFI1WBQ","Income"
47
- "[debit] PAYPAL INST XFER NETFLIX WEB ID: PAYPALSI42","Subscription"
48
- "[debit] SCHWAB MONEYLINK PPD ID: 207802622","Transfer"
49
  "[credit] AUTOMATIC PAYMENT - THANK","Transfer"
50
- "[debit] PreApproved Payment Bill User Payment: Google","Subscription"
 
51
  ```
52
 
53
- ## Categories (16)
54
 
55
  | Category | Count | Examples |
56
  |----------|-------|----------|
57
- | Restaurants | 1,500 | `[debit] MCDONALD'S F28471`, `[debit] TST*SAKURA SUSHI`, `[debit] CLV*BURGER JOINT` |
58
- | Groceries | 1,500 | `[debit] SAFEWAY #1197`, `[debit] WHOLEFDS FRE #10467`, `[debit] 365 MARKET` |
59
- | Shopping | 1,500 | `[debit] Amazon.com*K8R2M5VN7`, `[debit] TIKTOK SHOP`, `[debit] TOTAL WINE` |
60
- | Transportation | 1,500 | `[debit] CHEVRON 0385291`, `[debit] CHARGEPOINT *STATION 1234`, `[debit] CA DMV FEE` |
61
- | Entertainment | 1,500 | `[debit] VALVE STEAM PURCHASE`, `[debit] DRAFTKINGS SPORTSBOOK`, `[debit] AMC THEATRES` |
62
- | Utilities | 1,500 | `[debit] PG&E`, `[debit] REPUBLIC SERVICES TRASH`, `[debit] SUNRUN SOLAR` |
63
- | Subscription | 1,500 | `[debit] PreApproved Payment Bill User Payment: Microsoft`, `[debit] OBSIDIAN.MD`, `[debit] RAPIDAPI` |
64
- | Healthcare | 1,500 | `[debit] TELADOC TELEHEALTH`, `[debit] ASPEN DENTAL`, `[debit] LENSCRAFTERS` |
65
- | Insurance | 1,500 | `[debit] FARMERS INS BILLING`, `[debit] STATE FARM PREMIUM`, `[debit] GEICO` |
66
- | Rent | 1,500 | `[debit] EQUITY RESIDENTIAL RENT PAYMENT`, `[debit] GREYSTAR LEASE PAYMENT` |
67
- | Travel | 1,500 | `[debit] ROYAL CARIBBEAN`, `[debit] TSA PRECHECK`, `[debit] MARRIOTT` |
68
- | Education | 1,500 | `[debit] WYZANT TUTORING`, `[debit] COURSERA`, `[debit] UNIVERSITY OF TUITION` |
69
- | Personal Care | 1,500 | `[debit] SPORT CLIPS`, `[debit] SEPHORA`, `[debit] MASSAGE ENVY` |
70
- | Transfer | 1,500 | `[debit] COINBASE ACH TRANSFER`, `[debit] WIRE TRANSFER TO NAME`, `[credit] ATM DEPOSIT` |
71
- | Income | 1,500 | `[credit] EMPLOYER PAYROLL PPD ID:`, `[credit] SSA TREAS 310 FED SAL`, `[credit] DOORDASH DASHERPAY` |
72
- | Fees | 1,500 | `[debit] OVERDRAFT FEE`, `[debit] ATM SURCHARGE`, `[debit] PAPER STATEMENT FEE` |
73
-
74
- ## Eight Format Templates
75
-
76
- 1. **ACH (Chase checking)** — `INSTITUTION PURPOSE DETAILS WEB/PPD ID: CODE`
77
- 2. **Merchant + ID (Chase credit)** `MERCHANT #1234` or `MERCHANT*ORDERID`
78
- 3. **Full address (Apple Card)** — `MERCHANT ADDRESS CITY ZIP STATE COUNTRY`
79
- 4. **PayPal wrappers** `PreApproved Payment Bill User Payment: MERCHANT`, `Express Checkout Payment: MERCHANT`, `PP*MERCHANT`, `PAYPAL *MERCHANT`, `PAYPAL INST XFER MERCHANT WEB ID:`
80
- 5. **Action prefix (Capital One)** — `Withdrawal from DESCRIPTION` / `Deposit from DESCRIPTION`
81
- 6. **POS prefixes** `SQ *MERCHANT`, `TST*MERCHANT`, `CLV*MERCHANT`
82
- 7. **Compressed names** `DAVESHOTCHICKEN`, `CHICKFILA`, `WHOLEFDS FRE`
83
- 8. **Simple** `MERCHANT` or `MERCHANT.COM`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  ## Variation Dimensions
86
 
@@ -88,20 +103,21 @@ description,category
88
  - **Spacing:** normal, extra-padded (ACH style), compressed
89
  - **Store numbers:** `#1234`, `1234`, `#01234`, absent
90
  - **Order IDs:** `*ORDERID` (Amazon style)
91
- - **POS prefixes:** `SQ *` (Square), `TST*` (Toast), `CLV*` (Clover)
 
92
  - **Addresses:** full, partial, zip-smashed-into-city (Apple Card quirk)
 
93
  - **Cities:** 36 US cities across multiple states
94
- - **Sign prefixes:** `[debit]` / `[credit]` with category-appropriate distributions
95
- - **Abbreviated merchant names:** real bank statement abbreviations
96
 
97
  ## Design Decisions
98
 
99
- - **No "Mortgage" category.** Mortgage transactions are classified by account type, not description. Every transaction on a mortgage account is a mortgage payment by definition.
100
  - **No "Business" category.** Whether a transaction is a business expense depends on the _account_, not the description.
101
- - **Transfer vs Income.** Sign prefix is the primary signal. `[credit] VENMO CASHOUT` = Income. `[debit] VENMO PAYMENT TO` = Transfer.
102
- - **Subscription vs Shopping.** `Amazon.com*ORDERID` = Shopping. `AMAZON WEB SERVICES` = Subscription. `X CORP. PAID FEATURES` = Subscription. `TIKTOK SHOP` = Shopping.
103
- - **PayPal wrappers across all categories.** The model learns to look past `PreApproved Payment Bill User Payment:` and classify based on the merchant inside.
104
- - **Balanced classes.** 1,500 samples per category prevents the classifier from defaulting to the most common class.
105
 
106
  ## Usage
107
 
@@ -115,14 +131,14 @@ print(ds["train"][0])
115
 
116
  ## Trained Model
117
 
118
- A DistilBERT model fine-tuned on this dataset is available at [DoDataThings/distilbert-us-transaction-classifier-v2](https://huggingface.co/DoDataThings/distilbert-us-transaction-classifier-v2).
119
 
120
  ## Generator
121
 
122
- The synthetic data generator script is open source:
123
 
124
  ```bash
125
- node scripts/generate-training-data.js --count 1500
126
  ```
127
 
128
  Available at [github.com/wnstnb/foliome](https://github.com/wnstnb/foliome).
 
16
 
17
  # US Bank Transaction Categories v2 — Synthetic Dataset
18
 
19
+ 68,000 sign-prefixed transaction descriptions across 17 spending categories, modeled after real US bank statement formats. Designed for training classifiers that work on actual bank data — not the clean `"Starbucks coffee"` descriptions that most datasets use.
20
 
21
+ **Successor to [v1](https://huggingface.co/datasets/DoDataThings/us-bank-transaction-categories).**
22
 
23
+ ## Why This Dataset
24
+
25
+ Real bank transaction data is private. But the _formats_ are universal — Chase, Apple Card, PayPal, Capital One, Mercury all produce descriptions with predictable structures. This dataset captures those structures with 500+ real merchant names, randomized store numbers, addresses, and reference codes.
 
 
 
 
 
 
26
 
27
+ ### Why Sign Prefixes
28
 
29
+ Bank transaction descriptions are ambiguous without direction. "VENMO CASHOUT" as a credit is income as a debit it's a transfer. `[debit]`/`[credit]` encodes the cardholder's perspective so the model can disambiguate.
30
 
31
+ Sign distributions per category reflect real-world patterns:
32
+ - Spending categories: 95%+ debit
33
+ - Income: 97% credit
34
+ - Transfer: 50/50 (bidirectional by nature)
35
 
36
  ## Format
37
 
 
40
  ```
41
  description,category
42
  "[debit] AMAZON MKTPL*K8R2M5VN7","Shopping"
43
+ "[credit] Patelco CU PAYROLL PPD ID: 321076470","Income"
44
+ "[debit] PreApproved Payment Bill User Payment: Netflix","Subscription"
45
+ "[debit] SCHWAB BROKERAGE MONEYLINK PPD ID: 9005586224","Transfer"
46
  "[credit] AUTOMATIC PAYMENT - THANK","Transfer"
47
+ "[debit] PP*SAFEWAY","Groceries"
48
+ "[debit] TST*GOLDEN DRAGON - OAKLAND","Restaurants"
49
  ```
50
 
51
+ ## Categories (17)
52
 
53
  | Category | Count | Examples |
54
  |----------|-------|----------|
55
+ | Restaurants | 4,000 | `TST*SAKURA SUSHI`, `DAVESHOTCHICKEN`, `CLV*BURGER JOINT`, `PP*CHIPOTLE` |
56
+ | Groceries | 4,000 | `SAFEWAY #1197`, `WHOLEFDS FRE #10467`, `PYPL*TRADER JOE'S`, `365 MARKET` |
57
+ | Shopping | 4,000 | `Amazon.com*K8R2M5VN7`, `TIKTOK SHOP`, `Express Checkout Payment: TARGET`, `TOTAL WINE` |
58
+ | Transportation | 4,000 | `CHEVRON 0385291`, `CHARGEPOINT *STATION 1234`, `COSTCO GAS #1061`, `CA DMV FEE` |
59
+ | Entertainment | 4,000 | `VALVE STEAM PURCHASE`, `DRAFTKINGS SPORTSBOOK`, `PreApproved Payment: Valve Corp.` |
60
+ | Utilities | 4,000 | `PG&E`, `PGANDE WEB ONLINE`, `REPUBLIC SERVICES TRASH`, `SUNRUN SOLAR` |
61
+ | Subscription | 4,000 | `CURSOR USAGE`, `X CORP. PAID FEATURES`, `PYPL*NETFLIX`, `SALESFORCE; Billing` |
62
+ | Healthcare | 4,000 | `TELADOC TELEHEALTH`, `KAISER PERMANENTE`, `PP*ASPEN DENTAL`, `BETTERHELP` |
63
+ | Insurance | 4,000 | `FARMERS INS BILLING`, `HOMESERVE USA`, `PreApproved Payment: STATE FARM` |
64
+ | Mortgage | 4,000 | `ROCKET MORTGAGE`, `PATELCO CU MORTGAGE`, `SOFI MORTGAGE PAYMENT`, `Principal Pmt` |
65
+ | Rent | 4,000 | `EQUITY RESIDENTIAL RENT PAYMENT`, `GREYSTAR LEASE PAYMENT` |
66
+ | Travel | 4,000 | `ROYAL CARIBBEAN`, `TSA PRECHECK`, `SWA INFLIGHT WIFI`, `MARRIOTT` |
67
+ | Education | 4,000 | `COURSERA`, `Express Checkout Payment: Scholastic Inc`, `BRILLIANT.ORG` |
68
+ | Personal Care | 4,000 | `SPORT CLIPS`, `SEPHORA`, `360 FITNESS LLC`, `TST*ISLAND VINTAGE SHAVE` |
69
+ | Transfer | 4,000 | `COINBASE ACH TRANSFER`, `WIRE TRANSFER TO NAME`, `ATM DEPOSIT`, `DDA TO DDA` |
70
+ | Income | 4,000 | `PAYROLL PPD ID:`, `SSA TREAS 310 FED SAL`, `DOORDASH DASHERPAY` |
71
+ | Fees | 4,000 | `OVERDRAFT FEE`, `ATM SURCHARGE`, `PAPER STATEMENT FEE` |
72
+
73
+ ## Eight Bank Statement Formats
74
+
75
+ Every spending category produces descriptions in all major US bank formats:
76
+
77
+ | Format | Structure | Banks |
78
+ |---|---|---|
79
+ | **Chase ACH** | `INSTITUTION PURPOSE PPD/WEB ID: CODE` | Chase checking |
80
+ | **Chase merchant** | `MERCHANT #STORE` or `MERCHANT*ORDERID` | Chase credit cards |
81
+ | **Apple Card** | `MERCHANT ADDRESS CITY ZIP STATE COUNTRY` | Apple Card |
82
+ | **PayPal** | `PreApproved Payment: MERCHANT`, `PP*`, `PYPL*`, `PAYPAL *`, `INST XFER` | PayPal (as card issuer) |
83
+ | **Capital One** | `Withdrawal from MERCHANT`, `Preauthorized Deposit from MERCHANT` | Capital One |
84
+ | **Mercury** | `MERCHANT; Description` or just `MERCHANT` | Mercury, neobanks |
85
+ | **POS** | `SQ *MERCHANT`, `TST*MERCHANT`, `CLV*MERCHANT` | Square, Toast, Clover |
86
+ | **Simple** | `MERCHANT`, `MERCHANT.COM`, `MERCHANT INC.` | Various |
87
+
88
+ ### PayPal as a Bank Format
89
+
90
+ PayPal isn't just a payment wrapper — it's a card issuer. People use PayPal credit/debit cards at any merchant. This dataset treats PayPal formats as first-class bank statement structures:
91
+
92
+ - `PreApproved Payment Bill User Payment: STARBUCKS` → Restaurants
93
+ - `PP*SAFEWAY` → Groceries
94
+ - `PYPL*NETFLIX` → Subscription
95
+ - `Express Checkout Payment: TARGET` → Shopping
96
+ - `PAYPAL INST XFER MEDIUM.COM WEB ID: PAYPALSI77` → Subscription
97
+
98
+ PayPal-formatted descriptions appear in all spending categories at realistic rates (5-15% of samples).
99
 
100
  ## Variation Dimensions
101
 
 
103
  - **Spacing:** normal, extra-padded (ACH style), compressed
104
  - **Store numbers:** `#1234`, `1234`, `#01234`, absent
105
  - **Order IDs:** `*ORDERID` (Amazon style)
106
+ - **POS prefixes:** `SQ *`, `TST*`, `CLV*`
107
+ - **PayPal prefixes:** `PP*`, `PYPL*`, `PAYPAL *`, `PreApproved Payment`, `Express Checkout`
108
  - **Addresses:** full, partial, zip-smashed-into-city (Apple Card quirk)
109
+ - **Compressed names:** `DAVESHOTCHICKEN`, `CHICKFILA`, `WHOLEFDS FRE`, `TRADERJOES`
110
  - **Cities:** 36 US cities across multiple states
111
+ - **Sign prefixes:** `[debit]`/`[credit]` with category-appropriate distributions
 
112
 
113
  ## Design Decisions
114
 
115
+ - **No "Housing" category.** Split into Mortgage (model-classified) and Rent (model-classified). Home maintenance Shopping.
116
  - **No "Business" category.** Whether a transaction is a business expense depends on the _account_, not the description.
117
+ - **Transfer vs Income uses sign.** `[credit] VENMO CASHOUT` = Income. `[debit] VENMO PAYMENT TO` = Transfer. The sign prefix is the primary disambiguator.
118
+ - **Subscription vs Shopping uses format cues.** `Amazon.com*ORDERID` = Shopping. `AMAZON WEB SERVICES` = Subscription. `X CORP. PAID FEATURES` = Subscription. `TIKTOK SHOP` = Shopping.
119
+ - **500+ real merchants** across restaurants (including culturally diverse cuisines), groceries, SaaS/AI tools, fintech platforms, crypto brokerages, EV charging, gambling/sportsbooks, and more.
120
+ - **Balanced classes.** 4,000 samples per category prevents the classifier from defaulting to the most common class.
121
 
122
  ## Usage
123
 
 
131
 
132
  ## Trained Model
133
 
134
+ A DistilBERT model fine-tuned on this dataset is available at [DoDataThings/distilbert-us-transaction-classifier-v2](https://huggingface.co/DoDataThings/distilbert-us-transaction-classifier-v2) — 99.9% validation accuracy, 96% of real-world classifications at 0.90+ confidence.
135
 
136
  ## Generator
137
 
138
+ The synthetic data generator is open source:
139
 
140
  ```bash
141
+ node scripts/generate-training-data.js --count 4000 # 4,000 per category
142
  ```
143
 
144
  Available at [github.com/wnstnb/foliome](https://github.com/wnstnb/foliome).