WillisBack commited on
Commit
fbe37ec
·
verified ·
1 Parent(s): 617b712

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +149 -0
  2. test.parquet +3 -0
  3. train.parquet +3 -0
README.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - consumer-finance
6
+ - complaints
7
+ - text-classification
8
+ - cfpb
9
+ - nlp
10
+ size_categories:
11
+ - 100K<n<1M
12
+ task_categories:
13
+ - text-classification
14
+ configs:
15
+ - config_name: default
16
+ data_files:
17
+ - split: train
18
+ path: train.parquet
19
+ - split: test
20
+ path: test.parquet
21
+ ---
22
+
23
+ # Consumer Finance Complaints — 11 Consolidated Labels
24
+
25
+ A cleaned, deduplicated, and label-consolidated version of the [US CFPB Consumer Complaints dataset](https://www.consumerfinance.gov/data-research/consumer-complaints/) for **multi-class text classification**.
26
+
27
+ ## Context
28
+
29
+ This dataset was prepared as part of **Project 12 — "Compare AI Algorithms: Machine Learning vs. LLM"** of the [OpenClassrooms AI Developer certification](https://openclassrooms.com/) by **William Derue**.
30
+
31
+ The project scenario involves **ZenAssist**, a customer support platform serving 200+ companies that wants to automatically label incoming consumer complaints to route them to the correct support department.
32
+
33
+ ### Source
34
+
35
+ The raw dataset was provided by OpenClassrooms:
36
+
37
+ ```
38
+ https://s3.eu-west-1.amazonaws.com/course.oc-static.com/projects/2464_Développeur_IA/P12/dataset.csv
39
+ ```
40
+
41
+ ## Dataset Description
42
+
43
+ Each row contains a consumer complaint text and its product category label.
44
+
45
+ | Column | Type | Description |
46
+ | ------- | ------------ | ----------------------------------------------------------- |
47
+ | `text` | `string` | The consumer complaint narrative (variable length, English) |
48
+ | `label` | `ClassLabel` | Product category — one of 11 consolidated labels |
49
+
50
+ ### Splits
51
+
52
+ | Split | Rows | Usage |
53
+ | ------- | ------: | ---------- |
54
+ | `train` | 293,698 | Training |
55
+ | `test` | 73,425 | Evaluation |
56
+
57
+ Total: **367,123 rows** after cleaning.
58
+
59
+ ### Label Distribution (full dataset)
60
+
61
+ | Label | Count | % |
62
+ | ----------------------- | ------: | ----: |
63
+ | Credit reporting | 110,293 | 30.0% |
64
+ | Debt collection | 84,318 | 23.0% |
65
+ | Mortgage | 52,945 | 14.4% |
66
+ | Credit card | 41,498 | 11.3% |
67
+ | Bank account | 27,714 | 7.5% |
68
+ | Student loan | 21,781 | 5.9% |
69
+ | Consumer Loan | 9,443 | 2.6% |
70
+ | Money transfer | 6,953 | 1.9% |
71
+ | Payday loan | 6,155 | 1.7% |
72
+ | Vehicle loan or lease | 5,720 | 1.6% |
73
+ | Other financial service | 303 | 0.1% |
74
+
75
+ ## Label Consolidation
76
+
77
+ The original CFPB dataset contains **18 raw product tags** with significant semantic overlap. We consolidated them into **11 categories**:
78
+
79
+ | Original Label | Consolidated Label |
80
+ | ---------------------------------------------------------------------------- | --------------------------- |
81
+ | Credit reporting, credit repair services, or other personal consumer reports | **Credit reporting** |
82
+ | Credit reporting | **Credit reporting** |
83
+ | Credit card | **Credit card** |
84
+ | Credit card or prepaid card | **Credit card** |
85
+ | Prepaid card | **Credit card** |
86
+ | Bank account or service | **Bank account** |
87
+ | Checking or savings account | **Bank account** |
88
+ | Payday loan | **Payday loan** |
89
+ | Payday loan, title loan, or personal loan | **Payday loan** |
90
+ | Money transfer, virtual currency, or money service | **Money transfer** |
91
+ | Money transfers | **Money transfer** |
92
+ | Mortgage | **Mortgage** |
93
+ | Debt collection | **Debt collection** |
94
+ | Student loan | **Student loan** |
95
+ | Consumer Loan | **Consumer Loan** |
96
+ | Vehicle loan or lease | **Vehicle loan or lease** |
97
+ | Other financial service | **Other financial service** |
98
+ | Virtual currency | **Other financial service** |
99
+
100
+ ### Rationale
101
+
102
+ - **Semantic deduplication**: "Credit card" and "Credit card or prepaid card" describe the same product family.
103
+ - **Virtual currency** (9 raw samples) was merged into **Other financial service** — too rare to learn as a standalone class.
104
+ - This consolidation reduces label ambiguity and improves classifier performance without losing meaningful distinctions.
105
+
106
+ ## Preprocessing
107
+
108
+ 1. **Text column selection**: Used `Consumer Claim` (or `Customer Claim`) as the text field.
109
+ 2. **Cleaning**: Stripped whitespace, removed empty rows and NaN values.
110
+ 3. **Deduplication**: Dropped duplicate `(text, label)` pairs → 367,123 unique rows.
111
+ 4. **Label mapping**: Applied the consolidation map above.
112
+ 5. **Split**: 80/20 stratified train/test split (seed=3407).
113
+
114
+ ## Usage
115
+
116
+ ```python
117
+ from datasets import load_dataset
118
+
119
+ ds = load_dataset("WillisBack/dataset-financial-user-claim")
120
+ print(ds)
121
+ # DatasetDict({
122
+ # train: Dataset({features: ['text', 'label'], num_rows: 293698})
123
+ # test: Dataset({features: ['text', 'label'], num_rows: 73425})
124
+ # })
125
+
126
+ # Access a sample
127
+ print(ds["train"][0])
128
+ # {'text': 'I was charged an overdraft fee...', 'label': 0}
129
+
130
+ # Decode label
131
+ print(ds["train"].features["label"].int2str(0))
132
+ # 'Bank account'
133
+ ```
134
+
135
+ ## Associated Model
136
+
137
+ This dataset was used to fine-tune [WillisBack/modernbert-large-consumer-finance-11cls](https://huggingface.co/WillisBack/modernbert-large-consumer-finance-11cls) — a ModernBERT-large encoder achieving **F1 macro 0.61** and **78.2% accuracy**.
138
+
139
+ ## Citation
140
+
141
+ ```bibtex
142
+ @misc{derue2026cfpb11cls,
143
+ author = {Derue, William},
144
+ title = {Consumer Finance Complaints Dataset — 11 Consolidated Labels},
145
+ year = {2026},
146
+ publisher = {Hugging Face},
147
+ url = {https://huggingface.co/datasets/WillisBack/dataset-financial-user-claim}
148
+ }
149
+ ```
test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97f2e64570352281685d1c65d59ab992eaac3dc8253c3e9965288d96ab55d8c2
3
+ size 43859705
train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:043f3247b543a50516cd8e7445144e5506ca2b7b18fd92bab755645dbbdb47b1
3
+ size 175750644