Datasets:
Update: code clean-up; New: dataset stats in README
Browse files
README.md
CHANGED
@@ -52,4 +52,101 @@ UTCD Datasets & Principles:
|
|
52 |
In order to make NLP models more broadly useful, zero-shot techniques need to be capable of label, domain \& aspect transfer. As such, in the construction of UTCD we enforce the following principles:
|
53 |
|
54 |
- **Textual labels**: In UTCD, we mandate the use of textual labels. While numerical label values are often used in classification tasks, descriptive textual labels such as those present in the datasets across UTCD enable the development of techniques that can leverage the class name which is instrumental in providing zero-shot support. As such, for each of the compiled datasets, labels are standardized such that the labels are descriptive of the text in natural language.
|
55 |
-
- **Diverse domains and Sequence lengths**: In addition to broad coverage of aspects, UTCD compiles diverse data across several domains such as Banking, Finance, Legal, etc each comprising varied length sequences (long and short). The datasets are listed above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
In order to make NLP models more broadly useful, zero-shot techniques need to be capable of label, domain \& aspect transfer. As such, in the construction of UTCD we enforce the following principles:
|
53 |
|
54 |
- **Textual labels**: In UTCD, we mandate the use of textual labels. While numerical label values are often used in classification tasks, descriptive textual labels such as those present in the datasets across UTCD enable the development of techniques that can leverage the class name which is instrumental in providing zero-shot support. As such, for each of the compiled datasets, labels are standardized such that the labels are descriptive of the text in natural language.
|
55 |
+
- **Diverse domains and Sequence lengths**: In addition to broad coverage of aspects, UTCD compiles diverse data across several domains such as Banking, Finance, Legal, etc each comprising varied length sequences (long and short). The datasets are listed above.
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
## Structure
|
60 |
+
|
61 |
+
### Data Samples
|
62 |
+
|
63 |
+
Each dataset sample contains the text, the label encoded as an integer, and the dataset name encoded as an integer.
|
64 |
+
|
65 |
+
```python
|
66 |
+
{
|
67 |
+
'text': 'My favourite food is anything I didn't have to cook myself.',
|
68 |
+
'labels': [215],
|
69 |
+
'dataset_name': 0
|
70 |
+
}
|
71 |
+
```
|
72 |
+
|
73 |
+
### Datasets Contained
|
74 |
+
|
75 |
+
The UTCD dataset contains 18 datasets, 9 `in-domain`, 9 `out-of-domain`, spanning 3 aspects: `sentiment`, `intent` and `topic`.
|
76 |
+
|
77 |
+
Below are statistics on the datasets.
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
**In-Domain Datasets**
|
82 |
+
|
83 |
+
| Dataset | Aspect | #Samples in Train/Test | #labels | average #token in text in Train/Test |
|
84 |
+
| ---------- | --------- | ---------------------- | ------- | ------------------------------------ |
|
85 |
+
| GoEmotions | sentiment | 43K/5.4K | 28 | 12/12 |
|
86 |
+
| TweetEval | sentiment | 45K/12K | 3 | 19/14 |
|
87 |
+
| Emotion | sentiment | 16K/2K | 6 | 17/17 |
|
88 |
+
| SGD | intent | 16K/4.2K | 26 | 8/9 |
|
89 |
+
| Clinc-150 | intent | 15K/4.5K | 150 | 8/8 |
|
90 |
+
| SLURP | intent | 12K/2.6K | 75 | 7/7 |
|
91 |
+
| AG News | topic | 120K7.6K | 4 | 38/37 |
|
92 |
+
| DBpedia | topic | 560K/70K | 14 | 45/45 |
|
93 |
+
| Yahoo | topic | 1.4M/60K | 10 | 10/10 |
|
94 |
+
|
95 |
+
**Out-of-Domain Datasets**
|
96 |
+
|
97 |
+
| Dataset | Aspect | #Samples in Train/Test | #labels | average #token in text |
|
98 |
+
| --------------------- | --------- | ---------------------- | ------- | ---------------------- |
|
99 |
+
| Amazon Polarity | sentiment | 3.6M/400K | 2 | 71/71 |
|
100 |
+
| Financial Phrase Bank | sentiment | 1.8K/453 | 3 | 19/19 |
|
101 |
+
| Yelp | sentiment | 650K/50K | 3 | 128/128 |
|
102 |
+
| Banking77 | intent | 10K/3.1K | 77 | 11/10 |
|
103 |
+
| SNIPS | intent | 14K/697 | 7 | 8/8 |
|
104 |
+
| NLU Eval | intent | 21K/5.2K | 68 | 7/7 |
|
105 |
+
| MultiEURLEX | topic | 55K/5K | 21 | 1198/1853 |
|
106 |
+
| Big Patent | topic | 25K/5K | 9 | 2872/2892 |
|
107 |
+
| Consumer Finance | topic | 630K/160K | 18 | 190/189 |
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
### Configurations
|
112 |
+
|
113 |
+
The `in-domain` and `out-of-domain` configurations has 2 splits: `train` and `test`.
|
114 |
+
|
115 |
+
The aspect-normalized configurations (`aspect-normalized-in-domain`, `aspect-normalized-out-of-domain`) has 3 splits: `train`, `validation` and `test`.
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
Below are statistics on the configuration splits.
|
120 |
+
|
121 |
+
**In-Domain Configuration**
|
122 |
+
|
123 |
+
| Split | #samples |
|
124 |
+
| ----- | --------- |
|
125 |
+
| Train | 2,192,703 |
|
126 |
+
| Test | 168,365 |
|
127 |
+
|
128 |
+
**Out-of-Domain Configuration**
|
129 |
+
|
130 |
+
| Split | #samples |
|
131 |
+
| ----- | --------- |
|
132 |
+
| Train | 4,996,673 |
|
133 |
+
| Test | 625,911 |
|
134 |
+
|
135 |
+
**Aspect-Normalized In-Domain Configuration**
|
136 |
+
|
137 |
+
| Split | #samples |
|
138 |
+
| ---------- | -------- |
|
139 |
+
| Train | 115,127 |
|
140 |
+
| Validation | 12,806 |
|
141 |
+
| Test | 168,365 |
|
142 |
+
|
143 |
+
**Aspect-Normalized Out-of-Domain Configuration**
|
144 |
+
|
145 |
+
| Split | #samples |
|
146 |
+
| ---------- | -------- |
|
147 |
+
| Train | 119,167 |
|
148 |
+
| Validation | 13,263 |
|
149 |
+
| Test | 625,911 |
|
150 |
+
|
151 |
+
|
152 |
+
|
utcd.py
CHANGED
@@ -52,35 +52,12 @@ class UtcdConfig(datasets.BuilderConfig):
|
|
52 |
|
53 |
|
54 |
config = StefConfig('config.json')
|
55 |
-
# mic(config('go_emotion'))
|
56 |
_split2hf_split = dict(train=datasets.Split.TRAIN, eval=datasets.Split.VALIDATION, test=datasets.Split.TEST)
|
57 |
|
58 |
|
59 |
class Utcd(datasets.GeneratorBasedBuilder):
|
60 |
"""UTCD: Universal Text Classification Dataset. Version 0.0."""
|
61 |
|
62 |
-
# _config = dict(
|
63 |
-
# go_emotion=dict(aspect='sentiment', domain='in', name='GoEmotions'),
|
64 |
-
# sentiment_tweets_2020=dict(aspect='sentiment', domain='in', name='TweetEval'),
|
65 |
-
# emotion=dict(aspect='sentiment', domain='in', name='Emotion'),
|
66 |
-
# sgd=dict(aspect='intent', domain='in', name='Schema-Guided Dialogue'),
|
67 |
-
# clinc_150=dict(aspect='intent', domain='in', name='Clinc-150'),
|
68 |
-
# slurp=dict(aspect='intent', domain='in', name='SLURP'),
|
69 |
-
# ag_news=dict(aspect='topic', domain='in', name='AG News'),
|
70 |
-
# dbpedia=dict(aspect='topic', domain='in', name='DBpedia'),
|
71 |
-
# yahoo=dict(aspect='topic', domain='in', name='Yahoo Answer Topics'),
|
72 |
-
#
|
73 |
-
# amazon_polarity=dict(aspect='sentiment', domain='out', name='Amazon Review Polarity'),
|
74 |
-
# finance_sentiment=dict( aspect='sentiment', domain='out', name='Financial Phrase Bank'),
|
75 |
-
# yelp=dict(aspect='sentiment', domain='out', name='Yelp Review'),
|
76 |
-
# banking77=dict(aspect='intent', domain='out', name='Banking77'),
|
77 |
-
# snips=dict(aspect='intent', domain='out', name='SNIPS'),
|
78 |
-
# nlu_evaluation=dict(aspect='intent', domain='out', name='NLU Evaluation'),
|
79 |
-
# multi_eurlex=dict(aspect='topic', domain='out', name='MultiEURLEX'),
|
80 |
-
# patent=dict(aspect='topic', domain='out', name='Big Patent'),
|
81 |
-
# consumer_finance=dict(aspect='topic', domain='out', name='Consumer Finance Complaints')
|
82 |
-
# )
|
83 |
-
|
84 |
VERSION = _VERSION
|
85 |
|
86 |
BUILDER_CONFIGS = [
|
|
|
52 |
|
53 |
|
54 |
config = StefConfig('config.json')
|
|
|
55 |
_split2hf_split = dict(train=datasets.Split.TRAIN, eval=datasets.Split.VALIDATION, test=datasets.Split.TEST)
|
56 |
|
57 |
|
58 |
class Utcd(datasets.GeneratorBasedBuilder):
|
59 |
"""UTCD: Universal Text Classification Dataset. Version 0.0."""
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
VERSION = _VERSION
|
62 |
|
63 |
BUILDER_CONFIGS = [
|