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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import csv
|
2 |
+
import os
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
logger = datasets.logging.get_logger(__name__)
|
6 |
+
|
7 |
+
_DESCRIPTION = """
|
8 |
+
The consumer compaint data set is derived from the consumer complaint database
|
9 |
+
for the purpose of benchmarking quantification / label shift algorithms. The
|
10 |
+
data set consists of records of compaints about consumer financial products and
|
11 |
+
services that the Consumer Financial Protection Bureau sent to companies for
|
12 |
+
response. Each record has a corresponding product / sub product field which can
|
13 |
+
be used as labels for text classification.
|
14 |
+
"""
|
15 |
+
|
16 |
+
_URLS = {
|
17 |
+
"ccd": "https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download",
|
18 |
+
}
|
19 |
+
|
20 |
+
_FIELDS = ["date", "product", "subproduct", "issue", "subissue", "text"]
|
21 |
+
_PRODUCT_CATEGORIES = [
|
22 |
+
"Checking or savings account",
|
23 |
+
"Credit card or prepaid card",
|
24 |
+
"Credit reporting, credit repair services, or other personal consumer reports",
|
25 |
+
"Debt collection",
|
26 |
+
"Money transfer, virtual currency, or money service",
|
27 |
+
"Mortgage",
|
28 |
+
"Payday loan, title loan, or personal loan",
|
29 |
+
"Student loan",
|
30 |
+
"Vehicle loan or lease",
|
31 |
+
]
|
32 |
+
|
33 |
+
|
34 |
+
class CcdConfig(datasets.BuilderConfig):
|
35 |
+
def __init__(
|
36 |
+
self,
|
37 |
+
training_files,
|
38 |
+
testing_files,
|
39 |
+
label_column="product",
|
40 |
+
label_classes=_PRODUCT_CATEGORIES,
|
41 |
+
**kwargs,
|
42 |
+
):
|
43 |
+
super().__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
44 |
+
self.label_column = label_column
|
45 |
+
self.label_classes = label_classes
|
46 |
+
self.training_files = training_files
|
47 |
+
self.testing_files = testing_files
|
48 |
+
|
49 |
+
|
50 |
+
class Ccd(datasets.GeneratorBasedBuilder):
|
51 |
+
BUILDER_CONFIGS = [
|
52 |
+
CcdConfig(
|
53 |
+
name="chrono01",
|
54 |
+
description="Training on 201507-201806 and testing on 201807-201906",
|
55 |
+
training_files=[
|
56 |
+
"201507.csv",
|
57 |
+
"201508.csv",
|
58 |
+
"201509.csv",
|
59 |
+
"201510.csv",
|
60 |
+
"201511.csv",
|
61 |
+
"201512.csv",
|
62 |
+
"201601.csv",
|
63 |
+
"201602.csv",
|
64 |
+
"201603.csv",
|
65 |
+
"201604.csv",
|
66 |
+
"201605.csv",
|
67 |
+
"201606.csv",
|
68 |
+
"201607.csv",
|
69 |
+
"201608.csv",
|
70 |
+
"201609.csv",
|
71 |
+
"201610.csv",
|
72 |
+
"201611.csv",
|
73 |
+
"201612.csv",
|
74 |
+
"201701.csv",
|
75 |
+
"201702.csv",
|
76 |
+
"201703.csv",
|
77 |
+
"201704.csv",
|
78 |
+
"201705.csv",
|
79 |
+
"201706.csv",
|
80 |
+
"201707.csv",
|
81 |
+
"201708.csv",
|
82 |
+
"201709.csv",
|
83 |
+
"201710.csv",
|
84 |
+
"201711.csv",
|
85 |
+
"201712.csv",
|
86 |
+
"201801.csv",
|
87 |
+
"201802.csv",
|
88 |
+
"201803.csv",
|
89 |
+
"201804.csv",
|
90 |
+
"201805.csv",
|
91 |
+
"201806.csv",
|
92 |
+
],
|
93 |
+
testing_files=[
|
94 |
+
"201807.csv",
|
95 |
+
"201808.csv",
|
96 |
+
"201809.csv",
|
97 |
+
"201810.csv",
|
98 |
+
"201811.csv",
|
99 |
+
"201812.csv",
|
100 |
+
"201901.csv",
|
101 |
+
"201902.csv",
|
102 |
+
"201903.csv",
|
103 |
+
"201904.csv",
|
104 |
+
"201905.csv",
|
105 |
+
"201906.csv",
|
106 |
+
],
|
107 |
+
),
|
108 |
+
CcdConfig(
|
109 |
+
name="chrono02",
|
110 |
+
description="Training on 201607-201906 and testing on 201907-202006",
|
111 |
+
training_files=[
|
112 |
+
"201607.csv",
|
113 |
+
"201608.csv",
|
114 |
+
"201609.csv",
|
115 |
+
"201610.csv",
|
116 |
+
"201611.csv",
|
117 |
+
"201612.csv",
|
118 |
+
"201701.csv",
|
119 |
+
"201702.csv",
|
120 |
+
"201703.csv",
|
121 |
+
"201704.csv",
|
122 |
+
"201705.csv",
|
123 |
+
"201706.csv",
|
124 |
+
"201707.csv",
|
125 |
+
"201708.csv",
|
126 |
+
"201709.csv",
|
127 |
+
"201710.csv",
|
128 |
+
"201711.csv",
|
129 |
+
"201712.csv",
|
130 |
+
"201801.csv",
|
131 |
+
"201802.csv",
|
132 |
+
"201803.csv",
|
133 |
+
"201804.csv",
|
134 |
+
"201805.csv",
|
135 |
+
"201806.csv",
|
136 |
+
"201807.csv",
|
137 |
+
"201808.csv",
|
138 |
+
"201809.csv",
|
139 |
+
"201810.csv",
|
140 |
+
"201811.csv",
|
141 |
+
"201812.csv",
|
142 |
+
"201901.csv",
|
143 |
+
"201902.csv",
|
144 |
+
"201903.csv",
|
145 |
+
"201904.csv",
|
146 |
+
"201905.csv",
|
147 |
+
"201906.csv",
|
148 |
+
],
|
149 |
+
testing_files=[
|
150 |
+
"201907.csv",
|
151 |
+
"201908.csv",
|
152 |
+
"201909.csv",
|
153 |
+
"201910.csv",
|
154 |
+
"201911.csv",
|
155 |
+
"201912.csv",
|
156 |
+
"202001.csv",
|
157 |
+
"202002.csv",
|
158 |
+
"202003.csv",
|
159 |
+
"202004.csv",
|
160 |
+
"202005.csv",
|
161 |
+
"202006.csv",
|
162 |
+
],
|
163 |
+
),
|
164 |
+
CcdConfig(
|
165 |
+
name="chrono03",
|
166 |
+
description="Training on 201707-202006 and testing on 202007-202106",
|
167 |
+
training_files=[
|
168 |
+
"201707.csv",
|
169 |
+
"201708.csv",
|
170 |
+
"201709.csv",
|
171 |
+
"201710.csv",
|
172 |
+
"201711.csv",
|
173 |
+
"201712.csv",
|
174 |
+
"201801.csv",
|
175 |
+
"201802.csv",
|
176 |
+
"201803.csv",
|
177 |
+
"201804.csv",
|
178 |
+
"201805.csv",
|
179 |
+
"201806.csv",
|
180 |
+
"201807.csv",
|
181 |
+
"201808.csv",
|
182 |
+
"201809.csv",
|
183 |
+
"201810.csv",
|
184 |
+
"201811.csv",
|
185 |
+
"201812.csv",
|
186 |
+
"201901.csv",
|
187 |
+
"201902.csv",
|
188 |
+
"201903.csv",
|
189 |
+
"201904.csv",
|
190 |
+
"201905.csv",
|
191 |
+
"201906.csv",
|
192 |
+
"201907.csv",
|
193 |
+
"201908.csv",
|
194 |
+
"201909.csv",
|
195 |
+
"201910.csv",
|
196 |
+
"201911.csv",
|
197 |
+
"201912.csv",
|
198 |
+
"202001.csv",
|
199 |
+
"202002.csv",
|
200 |
+
"202003.csv",
|
201 |
+
"202004.csv",
|
202 |
+
"202005.csv",
|
203 |
+
"202006.csv",
|
204 |
+
],
|
205 |
+
testing_files=[
|
206 |
+
"202007.csv",
|
207 |
+
"202008.csv",
|
208 |
+
"202009.csv",
|
209 |
+
"202010.csv",
|
210 |
+
"202011.csv",
|
211 |
+
"202012.csv",
|
212 |
+
"202101.csv",
|
213 |
+
"202102.csv",
|
214 |
+
"202103.csv",
|
215 |
+
"202104.csv",
|
216 |
+
"202105.csv",
|
217 |
+
"202106.csv",
|
218 |
+
],
|
219 |
+
),
|
220 |
+
CcdConfig(
|
221 |
+
name="trainlow_testhigh01",
|
222 |
+
description="Training on low entropy label distribution splits and testing on high entropy splits",
|
223 |
+
training_files=[
|
224 |
+
"201709.csv",
|
225 |
+
"202106.csv",
|
226 |
+
"202005.csv",
|
227 |
+
"202012.csv",
|
228 |
+
"202011.csv",
|
229 |
+
"202007.csv",
|
230 |
+
"202008.csv",
|
231 |
+
"202101.csv",
|
232 |
+
"202009.csv",
|
233 |
+
"202003.csv",
|
234 |
+
"202010.csv",
|
235 |
+
"202006.csv",
|
236 |
+
"202004.csv",
|
237 |
+
"202105.csv",
|
238 |
+
"202001.csv",
|
239 |
+
"202002.csv",
|
240 |
+
"201908.csv",
|
241 |
+
"202103.csv",
|
242 |
+
"202102.csv",
|
243 |
+
"201907.csv",
|
244 |
+
"202104.csv",
|
245 |
+
"201906.csv",
|
246 |
+
"201911.csv",
|
247 |
+
"201912.csv",
|
248 |
+
"201905.csv",
|
249 |
+
"201910.csv",
|
250 |
+
"201909.csv",
|
251 |
+
"201811.csv",
|
252 |
+
"201904.csv",
|
253 |
+
"201902.csv",
|
254 |
+
"201903.csv",
|
255 |
+
"201810.csv",
|
256 |
+
"201802.csv",
|
257 |
+
"201808.csv",
|
258 |
+
"201812.csv",
|
259 |
+
"201805.csv",
|
260 |
+
],
|
261 |
+
testing_files=[
|
262 |
+
"201710.csv",
|
263 |
+
"201803.csv",
|
264 |
+
"201807.csv",
|
265 |
+
"201809.csv",
|
266 |
+
"201804.csv",
|
267 |
+
"201707.csv",
|
268 |
+
"201708.csv",
|
269 |
+
"201901.csv",
|
270 |
+
"201711.csv",
|
271 |
+
"201806.csv",
|
272 |
+
"201705.csv",
|
273 |
+
"201712.csv",
|
274 |
+
],
|
275 |
+
),
|
276 |
+
CcdConfig(
|
277 |
+
name="trainlow_testhigh02",
|
278 |
+
description="Training on low entropy label distribution splits and testing on high entropy splits",
|
279 |
+
training_files=[
|
280 |
+
"202004.csv",
|
281 |
+
"202105.csv",
|
282 |
+
"202001.csv",
|
283 |
+
"202002.csv",
|
284 |
+
"201908.csv",
|
285 |
+
"202103.csv",
|
286 |
+
"202102.csv",
|
287 |
+
"201907.csv",
|
288 |
+
"202104.csv",
|
289 |
+
"201906.csv",
|
290 |
+
"201911.csv",
|
291 |
+
"201912.csv",
|
292 |
+
"201905.csv",
|
293 |
+
"201910.csv",
|
294 |
+
"201909.csv",
|
295 |
+
"201811.csv",
|
296 |
+
"201904.csv",
|
297 |
+
"201902.csv",
|
298 |
+
"201903.csv",
|
299 |
+
"201810.csv",
|
300 |
+
"201802.csv",
|
301 |
+
"201808.csv",
|
302 |
+
"201812.csv",
|
303 |
+
"201805.csv",
|
304 |
+
"201710.csv",
|
305 |
+
"201803.csv",
|
306 |
+
"201807.csv",
|
307 |
+
"201809.csv",
|
308 |
+
"201804.csv",
|
309 |
+
"201707.csv",
|
310 |
+
"201708.csv",
|
311 |
+
"201901.csv",
|
312 |
+
"201711.csv",
|
313 |
+
"201806.csv",
|
314 |
+
"201705.csv",
|
315 |
+
"201712.csv",
|
316 |
+
],
|
317 |
+
testing_files=[
|
318 |
+
"201706.csv",
|
319 |
+
"201801.csv",
|
320 |
+
"201508.csv",
|
321 |
+
"201507.csv",
|
322 |
+
"201509.csv",
|
323 |
+
"201602.csv",
|
324 |
+
"201512.csv",
|
325 |
+
"201601.csv",
|
326 |
+
"201704.csv",
|
327 |
+
"201511.csv",
|
328 |
+
"201603.csv",
|
329 |
+
"201510.csv",
|
330 |
+
],
|
331 |
+
),
|
332 |
+
CcdConfig(
|
333 |
+
name="trainlow_testhigh03",
|
334 |
+
description="Training on low entropy label distribution splits and testing on high entropy splits",
|
335 |
+
training_files=[
|
336 |
+
"201905.csv",
|
337 |
+
"201910.csv",
|
338 |
+
"201909.csv",
|
339 |
+
"201811.csv",
|
340 |
+
"201904.csv",
|
341 |
+
"201902.csv",
|
342 |
+
"201903.csv",
|
343 |
+
"201810.csv",
|
344 |
+
"201802.csv",
|
345 |
+
"201808.csv",
|
346 |
+
"201812.csv",
|
347 |
+
"201805.csv",
|
348 |
+
"201710.csv",
|
349 |
+
"201803.csv",
|
350 |
+
"201807.csv",
|
351 |
+
"201809.csv",
|
352 |
+
"201804.csv",
|
353 |
+
"201707.csv",
|
354 |
+
"201708.csv",
|
355 |
+
"201901.csv",
|
356 |
+
"201711.csv",
|
357 |
+
"201806.csv",
|
358 |
+
"201705.csv",
|
359 |
+
"201712.csv",
|
360 |
+
"201706.csv",
|
361 |
+
"201801.csv",
|
362 |
+
"201508.csv",
|
363 |
+
"201507.csv",
|
364 |
+
"201509.csv",
|
365 |
+
"201602.csv",
|
366 |
+
"201512.csv",
|
367 |
+
"201601.csv",
|
368 |
+
"201704.csv",
|
369 |
+
"201511.csv",
|
370 |
+
"201603.csv",
|
371 |
+
"201510.csv",
|
372 |
+
],
|
373 |
+
testing_files=[
|
374 |
+
"201701.csv",
|
375 |
+
"201605.csv",
|
376 |
+
"201607.csv",
|
377 |
+
"201612.csv",
|
378 |
+
"201604.csv",
|
379 |
+
"201606.csv",
|
380 |
+
"201608.csv",
|
381 |
+
"201703.csv",
|
382 |
+
"201610.csv",
|
383 |
+
"201611.csv",
|
384 |
+
"201609.csv",
|
385 |
+
"201702.csv",
|
386 |
+
],
|
387 |
+
),
|
388 |
+
CcdConfig(
|
389 |
+
name="trainhigh_testlow01",
|
390 |
+
description="Training on high entropy label distribution splits and testing on low entropy splits",
|
391 |
+
training_files=[
|
392 |
+
"201710.csv",
|
393 |
+
"201803.csv",
|
394 |
+
"201807.csv",
|
395 |
+
"201809.csv",
|
396 |
+
"201804.csv",
|
397 |
+
"201707.csv",
|
398 |
+
"201708.csv",
|
399 |
+
"201901.csv",
|
400 |
+
"201711.csv",
|
401 |
+
"201806.csv",
|
402 |
+
"201705.csv",
|
403 |
+
"201712.csv",
|
404 |
+
"201706.csv",
|
405 |
+
"201801.csv",
|
406 |
+
"201508.csv",
|
407 |
+
"201507.csv",
|
408 |
+
"201509.csv",
|
409 |
+
"201602.csv",
|
410 |
+
"201512.csv",
|
411 |
+
"201601.csv",
|
412 |
+
"201704.csv",
|
413 |
+
"201511.csv",
|
414 |
+
"201603.csv",
|
415 |
+
"201510.csv",
|
416 |
+
"201701.csv",
|
417 |
+
"201605.csv",
|
418 |
+
"201607.csv",
|
419 |
+
"201612.csv",
|
420 |
+
"201604.csv",
|
421 |
+
"201606.csv",
|
422 |
+
"201608.csv",
|
423 |
+
"201703.csv",
|
424 |
+
"201610.csv",
|
425 |
+
"201611.csv",
|
426 |
+
"201609.csv",
|
427 |
+
"201702.csv",
|
428 |
+
],
|
429 |
+
testing_files=[
|
430 |
+
"201905.csv",
|
431 |
+
"201910.csv",
|
432 |
+
"201909.csv",
|
433 |
+
"201811.csv",
|
434 |
+
"201904.csv",
|
435 |
+
"201902.csv",
|
436 |
+
"201903.csv",
|
437 |
+
"201810.csv",
|
438 |
+
"201802.csv",
|
439 |
+
"201808.csv",
|
440 |
+
"201812.csv",
|
441 |
+
"201805.csv",
|
442 |
+
],
|
443 |
+
),
|
444 |
+
CcdConfig(
|
445 |
+
name="trainhigh_testlow02",
|
446 |
+
description="Training on high entropy label distribution splits and testing on low entropy splits",
|
447 |
+
training_files=[
|
448 |
+
"201905.csv",
|
449 |
+
"201910.csv",
|
450 |
+
"201909.csv",
|
451 |
+
"201811.csv",
|
452 |
+
"201904.csv",
|
453 |
+
"201902.csv",
|
454 |
+
"201903.csv",
|
455 |
+
"201810.csv",
|
456 |
+
"201802.csv",
|
457 |
+
"201808.csv",
|
458 |
+
"201812.csv",
|
459 |
+
"201805.csv",
|
460 |
+
"201710.csv",
|
461 |
+
"201803.csv",
|
462 |
+
"201807.csv",
|
463 |
+
"201809.csv",
|
464 |
+
"201804.csv",
|
465 |
+
"201707.csv",
|
466 |
+
"201708.csv",
|
467 |
+
"201901.csv",
|
468 |
+
"201711.csv",
|
469 |
+
"201806.csv",
|
470 |
+
"201705.csv",
|
471 |
+
"201712.csv",
|
472 |
+
"201706.csv",
|
473 |
+
"201801.csv",
|
474 |
+
"201508.csv",
|
475 |
+
"201507.csv",
|
476 |
+
"201509.csv",
|
477 |
+
"201602.csv",
|
478 |
+
"201512.csv",
|
479 |
+
"201601.csv",
|
480 |
+
"201704.csv",
|
481 |
+
"201511.csv",
|
482 |
+
"201603.csv",
|
483 |
+
"201510.csv",
|
484 |
+
],
|
485 |
+
testing_files=[
|
486 |
+
"202004.csv",
|
487 |
+
"202105.csv",
|
488 |
+
"202001.csv",
|
489 |
+
"202002.csv",
|
490 |
+
"201908.csv",
|
491 |
+
"202103.csv",
|
492 |
+
"202102.csv",
|
493 |
+
"201907.csv",
|
494 |
+
"202104.csv",
|
495 |
+
"201906.csv",
|
496 |
+
"201911.csv",
|
497 |
+
"201912.csv",
|
498 |
+
],
|
499 |
+
),
|
500 |
+
CcdConfig(
|
501 |
+
name="trainhigh_testlow03",
|
502 |
+
description="Training on high entropy label distribution splits and testing on low entropy splits",
|
503 |
+
training_files=[
|
504 |
+
"202004.csv",
|
505 |
+
"202105.csv",
|
506 |
+
"202001.csv",
|
507 |
+
"202002.csv",
|
508 |
+
"201908.csv",
|
509 |
+
"202103.csv",
|
510 |
+
"202102.csv",
|
511 |
+
"201907.csv",
|
512 |
+
"202104.csv",
|
513 |
+
"201906.csv",
|
514 |
+
"201911.csv",
|
515 |
+
"201912.csv",
|
516 |
+
"201905.csv",
|
517 |
+
"201910.csv",
|
518 |
+
"201909.csv",
|
519 |
+
"201811.csv",
|
520 |
+
"201904.csv",
|
521 |
+
"201902.csv",
|
522 |
+
"201903.csv",
|
523 |
+
"201810.csv",
|
524 |
+
"201802.csv",
|
525 |
+
"201808.csv",
|
526 |
+
"201812.csv",
|
527 |
+
"201805.csv",
|
528 |
+
"201710.csv",
|
529 |
+
"201803.csv",
|
530 |
+
"201807.csv",
|
531 |
+
"201809.csv",
|
532 |
+
"201804.csv",
|
533 |
+
"201707.csv",
|
534 |
+
"201708.csv",
|
535 |
+
"201901.csv",
|
536 |
+
"201711.csv",
|
537 |
+
"201806.csv",
|
538 |
+
"201705.csv",
|
539 |
+
"201712.csv",
|
540 |
+
],
|
541 |
+
testing_files=[
|
542 |
+
"201709.csv",
|
543 |
+
"202106.csv",
|
544 |
+
"202005.csv",
|
545 |
+
"202012.csv",
|
546 |
+
"202011.csv",
|
547 |
+
"202007.csv",
|
548 |
+
"202008.csv",
|
549 |
+
"202101.csv",
|
550 |
+
"202009.csv",
|
551 |
+
"202003.csv",
|
552 |
+
"202010.csv",
|
553 |
+
"202006.csv",
|
554 |
+
],
|
555 |
+
),
|
556 |
+
]
|
557 |
+
|
558 |
+
def _info(self):
|
559 |
+
features = {
|
560 |
+
"date": datasets.Value("string"),
|
561 |
+
"id": datasets.Value("int32"),
|
562 |
+
"label": datasets.features.ClassLabel(names=self.config.label_classes),
|
563 |
+
"text": datasets.Value("string"),
|
564 |
+
}
|
565 |
+
return datasets.DatasetInfo(
|
566 |
+
description=_DESCRIPTION,
|
567 |
+
features=datasets.Features(features),
|
568 |
+
)
|
569 |
+
|
570 |
+
def _split_generators(self, dl_manager):
|
571 |
+
downloaded_files = dl_manager.download_and_extract(_URLS)
|
572 |
+
logger.info(str(downloaded_files))
|
573 |
+
dirname = downloaded_files["ccd"]
|
574 |
+
train_filepaths = tuple(
|
575 |
+
os.path.join(dirname, "ccd", fname) for fname in self.config.training_files
|
576 |
+
)
|
577 |
+
test_filepaths = tuple(
|
578 |
+
os.path.join(dirname, "ccd", fname) for fname in self.config.testing_files
|
579 |
+
)
|
580 |
+
return [
|
581 |
+
datasets.SplitGenerator(
|
582 |
+
name=datasets.Split.TRAIN,
|
583 |
+
gen_kwargs={"filepaths": train_filepaths},
|
584 |
+
),
|
585 |
+
datasets.SplitGenerator(
|
586 |
+
name=datasets.Split.TEST,
|
587 |
+
gen_kwargs={"filepaths": test_filepaths},
|
588 |
+
),
|
589 |
+
]
|
590 |
+
|
591 |
+
def _generate_examples(self, filepaths):
|
592 |
+
logger.info(f"generating examples from {len(filepaths)} files")
|
593 |
+
idx = 0
|
594 |
+
for filepath in filepaths:
|
595 |
+
with open(filepath, encoding="utf-8") as f:
|
596 |
+
reader = csv.DictReader(f, fieldnames=_FIELDS)
|
597 |
+
for row in reader:
|
598 |
+
yield idx, {
|
599 |
+
"date": row["date"],
|
600 |
+
"id": idx,
|
601 |
+
"label": row[self.config.label_column],
|
602 |
+
"text": row["text"],
|
603 |
+
}
|
604 |
+
idx += 1
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"chrono01": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "chrono01", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 324575058, "num_examples": 291484, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 129287467, "num_examples": 114911, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 453862525, "size_in_bytes": 734429877}, "chrono02": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "chrono02", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 376547815, "num_examples": 334674, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 161198463, "num_examples": 148162, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 537746278, "size_in_bytes": 818313630}, "chrono03": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "chrono03", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 433608620, "num_examples": 388443, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 197759491, "num_examples": 191112, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 631368111, "size_in_bytes": 911935463}, "trainlow_testhigh01": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "trainlow_testhigh01", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 495008012, "num_examples": 462190, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 136172122, "num_examples": 115601, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 631180134, "size_in_bytes": 911747486}, "trainlow_testhigh02": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "trainlow_testhigh02", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 439330670, "num_examples": 393943, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 89952506, "num_examples": 82185, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 529283176, "size_in_bytes": 809850528}, "trainlow_testhigh03": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "trainlow_testhigh03", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 361158638, "num_examples": 318695, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 91687839, "num_examples": 85693, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 452846477, "size_in_bytes": 733413829}, "trainhigh_testlow01": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "trainhigh_testlow01", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 317812459, "num_examples": 283479, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 135034026, "num_examples": 120909, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 452846485, "size_in_bytes": 733413837}, "trainhigh_testlow02": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "trainhigh_testlow02", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 361158638, "num_examples": 318695, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 168124530, "num_examples": 157433, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 529283168, "size_in_bytes": 809850520}, "trainhigh_testlow03": {"description": "\nThe consumer compaint data set is derived from the consumer complaint database\nfor the purpose of benchmarking quantification / label shift algorithms. The\ndata set consists of records of compaints about consumer financial products and\nservices that the Consumer Financial Protection Bureau sent to companies for \nresponse. Each record has a corresponding product / sub product field which can\nbe used as labels for text classification.\n", "citation": "", "homepage": "", "license": "", "features": {"date": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "label": {"num_classes": 9, "names": ["Checking or savings account", "Credit card or prepaid card", "Credit reporting, credit repair services, or other personal consumer reports", "Debt collection", "Money transfer, virtual currency, or money service", "Mortgage", "Payday loan, title loan, or personal loan", "Student loan", "Vehicle loan or lease"], "names_file": null, "id": null, "_type": "ClassLabel"}, "text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ccd", "config_name": "trainhigh_testlow03", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 439330670, "num_examples": 393943, "dataset_name": "ccd"}, "test": {"name": "test", "num_bytes": 191849464, "num_examples": 183848, "dataset_name": "ccd"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1UVCa-9oh5Oz5cPO7kQluY8am1pAUUbes&export=download": {"num_bytes": 280567352, "checksum": "769615657d58e251664193e21340e44feeb9962029efc4cafd2c3ab4c85f3aeb"}}, "download_size": 280567352, "post_processing_size": null, "dataset_size": 631180134, "size_in_bytes": 911747486}}
|