DoDataThings commited on
Commit
ccf9039
·
verified ·
1 Parent(s): 5fb314a

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +132 -0
README.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - text-classification
5
+ - finance
6
+ - transactions
7
+ - english
8
+ - synthetic
9
+ task_categories:
10
+ - text-classification
11
+ language:
12
+ - en
13
+ size_categories:
14
+ - 10K<n<100K
15
+ ---
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
+
41
+ CSV with two columns:
42
+
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
+
87
+ - **Capitalization:** ALL CAPS, Title Case, lowercase, mixed
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
+
108
+ ```python
109
+ from datasets import load_dataset
110
+
111
+ ds = load_dataset("DoDataThings/us-bank-transaction-categories-v2")
112
+ print(ds["train"][0])
113
+ # {'description': '[debit] AMAZON MKTPL*K8R2M5VN7', 'category': 'Shopping'}
114
+ ```
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).
129
+
130
+ ## License
131
+
132
+ MIT