ArneBinder commited on
Commit
6096fe9
1 Parent(s): 277dc70

https://github.com/ArneBinder/pie-datasets/pull/100

Browse files
README.md CHANGED
@@ -10,6 +10,29 @@ A novel corpus of healthcare texts (i.e., RCT abstracts on various diseases) fro
10
  are annotated with argumentative components (i.e., `MajorClaim`, `Claim`, and `Premise`) and relations (i.e., `Support`, `Attack`, and `Partial-attack`),
11
  in order to support clinicians' daily tasks in information finding and evidence-based reasoning for decision making.
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ### Supported Tasks and Leaderboards
14
 
15
  - **Tasks**: Argumentation Mining, Component Identification, Boundary Detection, Relation Identification, Link Prediction
@@ -30,17 +53,6 @@ Without any need to merge fragments, the document type `BratDocumentWithMergedSp
30
 
31
  See [PIE-Brat Data Schema](https://huggingface.co/datasets/pie/brat#data-schema).
32
 
33
- ### Usage
34
-
35
- ```python
36
- from pie_datasets import load_dataset, builders
37
-
38
- # load default version
39
- datasets = load_dataset("pie/abstrct")
40
- doc = datasets["neoplasm_train"][0]
41
- assert isinstance(doc, builders.brat.BratDocumentWithMergedSpans)
42
- ```
43
-
44
  ### Document Converters
45
 
46
  The dataset provides document converters for the following target document types:
@@ -51,8 +63,7 @@ The dataset provides document converters for the following target document types
51
  - `BinraryRelations`, converted from `BratDocumentWithMergedSpans`'s `relations`
52
  - labels: `Support`, `Partial-Attack`, `Attack`
53
 
54
- See [here](https://github.com/ChristophAlt/pytorch-ie/blob/main/src/pytorch_ie/documents.py) for the document type
55
- definitions.
56
 
57
  ### Data Splits
58
 
@@ -65,7 +76,7 @@ definitions.
65
  - `mixed_test` contains 20 abstracts on the following diseases: glaucoma, neoplasm, diabetes, hypertension, hepatitis.
66
  - 31 out of 40 abstracts in `mixed_test` overlap with abstracts in `neoplasm_test` and `glaucoma_test`.
67
 
68
- ### Label Descriptions
69
 
70
  In this section, we describe labels according to [Mayer et al. (2020)](https://ebooks.iospress.nl/publication/55129), as well as our label counts on 669 abstracts.
71
 
@@ -105,6 +116,240 @@ Morio et al. ([2022](https://aclanthology.org/2022.tacl-1.37.pdf); p. 642, Table
105
 
106
  (Mayer et al. 2020, p.2110)
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  ## Dataset Creation
109
 
110
  ### Curation Rationale
 
10
  are annotated with argumentative components (i.e., `MajorClaim`, `Claim`, and `Premise`) and relations (i.e., `Support`, `Attack`, and `Partial-attack`),
11
  in order to support clinicians' daily tasks in information finding and evidence-based reasoning for decision making.
12
 
13
+ ### Usage
14
+
15
+ ```python
16
+ from pie_datasets import load_dataset
17
+ from pie_datasets.builders.brat import BratDocumentWithMergedSpans
18
+ from pytorch_ie.documents import TextDocumentWithLabeledSpansAndBinaryRelations
19
+
20
+ # load default version
21
+ dataset = load_dataset("pie/abstrct")
22
+ assert isinstance(dataset["neoplasm_train"][0], BratDocumentWithMergedSpans)
23
+
24
+ # if required, normalize the document type (see section Document Converters below)
25
+ dataset_converted = dataset.to_document_type("pytorch_ie.documents.TextDocumentWithLabeledSpansAndBinaryRelations")
26
+ assert isinstance(dataset_converted["neoplasm_train"][0], TextDocumentWithLabeledSpansAndBinaryRelations)
27
+
28
+ # get first relation in the first document
29
+ doc = dataset_converted["neoplasm_train"][0]
30
+ print(doc.binary_relations[0])
31
+ # BinaryRelation(head=LabeledSpan(start=1769, end=1945, label='Claim', score=1.0), tail=LabeledSpan(start=1, end=162, label='MajorClaim', score=1.0), label='Support', score=1.0)
32
+ print(doc.binary_relations[0].resolve())
33
+ # ('Support', (('Claim', 'Treatment with mitoxantrone plus prednisone was associated with greater and longer-lasting improvement in several HQL domains and symptoms than treatment with prednisone alone.'), ('MajorClaim', 'A combination of mitoxantrone plus prednisone is preferable to prednisone alone for reduction of pain in men with metastatic, hormone-resistant, prostate cancer.')))
34
+ ```
35
+
36
  ### Supported Tasks and Leaderboards
37
 
38
  - **Tasks**: Argumentation Mining, Component Identification, Boundary Detection, Relation Identification, Link Prediction
 
53
 
54
  See [PIE-Brat Data Schema](https://huggingface.co/datasets/pie/brat#data-schema).
55
 
 
 
 
 
 
 
 
 
 
 
 
56
  ### Document Converters
57
 
58
  The dataset provides document converters for the following target document types:
 
63
  - `BinraryRelations`, converted from `BratDocumentWithMergedSpans`'s `relations`
64
  - labels: `Support`, `Partial-Attack`, `Attack`
65
 
66
+ See [here](https://github.com/ChristophAlt/pytorch-ie/blob/main/src/pytorch_ie/documents.py) for the document type definitions.
 
67
 
68
  ### Data Splits
69
 
 
76
  - `mixed_test` contains 20 abstracts on the following diseases: glaucoma, neoplasm, diabetes, hypertension, hepatitis.
77
  - 31 out of 40 abstracts in `mixed_test` overlap with abstracts in `neoplasm_test` and `glaucoma_test`.
78
 
79
+ ### Label Descriptions and Statistics
80
 
81
  In this section, we describe labels according to [Mayer et al. (2020)](https://ebooks.iospress.nl/publication/55129), as well as our label counts on 669 abstracts.
82
 
 
116
 
117
  (Mayer et al. 2020, p.2110)
118
 
119
+ #### Example
120
+
121
+ ![abstr-sam.png](img%2Fabstr-sam.png)
122
+
123
+ ### Collected Statistics after Document Conversion
124
+
125
+ We use the script `evaluate_documents.py` from [PyTorch-IE-Hydra-Template](https://github.com/ArneBinder/pytorch-ie-hydra-template-1) to generate these statistics.
126
+ After checking out that code, the statistics and plots can be generated by the command:
127
+
128
+ ```commandline
129
+ python src/evaluate_documents.py dataset=abstrct_base metric=METRIC
130
+ ```
131
+
132
+ where a `METRIC` is called according to the available metric configs in `config/metric/METRIC` (see [metrics](https://github.com/ArneBinder/pytorch-ie-hydra-template-1/tree/main/configs/metric)).
133
+
134
+ This also requires to have the following dataset config in `configs/dataset/abstrct_base.yaml` of this dataset within the repo directory:
135
+
136
+ ```commandline
137
+ _target_: src.utils.execute_pipeline
138
+ input:
139
+ _target_: pie_datasets.DatasetDict.load_dataset
140
+ path: pie/abstrct
141
+ revision: 277dc703fd78614635e86fe57c636b54931538b2
142
+ ```
143
+
144
+ For token based metrics, this uses `bert-base-uncased` from `transformer.AutoTokenizer` (see [AutoTokenizer](https://huggingface.co/docs/transformers/v4.37.1/en/model_doc/auto#transformers.AutoTokenizer), and [bert-based-uncased](https://huggingface.co/bert-base-uncased) to tokenize `text` in `TextDocumentWithLabeledSpansAndBinaryRelations` (see [document type](https://github.com/ChristophAlt/pytorch-ie/blob/main/src/pytorch_ie/documents.py)).
145
+
146
+ #### Relation argument (outer) token distance per label
147
+
148
+ The distance is measured from the first token of the first argumentative unit to the last token of the last unit, a.k.a. outer distance.
149
+
150
+ We collect the following statistics: number of documents in the split (*no. doc*), no. of relations (*len*), mean of token distance (*mean*), standard deviation of the distance (*std*), minimum outer distance (*min*), and maximum outer distance (*max*).
151
+ We also present histograms in the collapsible, showing the distribution of these relation distances (x-axis; and unit-counts in y-axis), accordingly.
152
+
153
+ <details>
154
+ <summary>Command</summary>
155
+
156
+ ```
157
+ python src/evaluate_documents.py dataset=abstrct_base metric=relation_argument_token_distances
158
+ ```
159
+
160
+ </details>
161
+
162
+ ##### neoplasm_train (350 documents)
163
+
164
+ | | len | max | mean | min | std |
165
+ | :------------- | ---: | --: | ------: | --: | -----: |
166
+ | ALL | 2836 | 511 | 132.903 | 17 | 80.869 |
167
+ | Attack | 72 | 346 | 89.639 | 29 | 75.554 |
168
+ | Partial-Attack | 338 | 324 | 59.024 | 17 | 42.773 |
169
+ | Support | 2426 | 511 | 144.481 | 26 | 79.187 |
170
+
171
+ <details>
172
+ <summary>Histogram (split: neoplasm_train, 350 documents)</summary>
173
+
174
+ ![img_2.png](img/rtd-label_abs-neo_train.png)
175
+
176
+ </details>
177
+
178
+ ##### neoplasm_dev (50 documents)
179
+
180
+ | | len | max | mean | min | std |
181
+ | :------------- | --: | --: | ------: | --: | -----: |
182
+ | ALL | 438 | 625 | 146.393 | 24 | 98.788 |
183
+ | Attack | 16 | 200 | 90.375 | 26 | 62.628 |
184
+ | Partial-Attack | 50 | 240 | 72.04 | 24 | 47.685 |
185
+ | Support | 372 | 625 | 158.796 | 34 | 99.922 |
186
+
187
+ <details>
188
+ <summary>Histogram (split: neoplasm_dev, 50 documents)</summary>
189
+
190
+ ![img_3.png](img/rtd-label_abs-neo_dev.png)
191
+
192
+ </details>
193
+
194
+ ##### neoplasm_test (100 documents)
195
+
196
+ | | len | max | mean | min | std |
197
+ | :------------- | --: | --: | ------: | --: | -----: |
198
+ | ALL | 848 | 459 | 126.731 | 22 | 75.363 |
199
+ | Attack | 32 | 390 | 115.688 | 22 | 97.262 |
200
+ | Partial-Attack | 88 | 205 | 56.955 | 24 | 34.534 |
201
+ | Support | 728 | 459 | 135.651 | 33 | 73.365 |
202
+
203
+ <details>
204
+ <summary>Histogram (split: neoplasm_test, 100 documents)</summary>
205
+
206
+ ![img_4.png](img/rtd-label_abs-neo_test.png)
207
+
208
+ </details>
209
+
210
+ ##### glaucoma_test (100 documents)
211
+
212
+ | | len | max | mean | min | std |
213
+ | :------------- | --: | --: | ------: | --: | -----: |
214
+ | ALL | 734 | 488 | 159.166 | 26 | 83.885 |
215
+ | Attack | 14 | 177 | 89 | 47 | 40.171 |
216
+ | Partial-Attack | 52 | 259 | 74 | 26 | 51.239 |
217
+ | Support | 668 | 488 | 167.266 | 38 | 82.222 |
218
+
219
+ <details>
220
+ <summary>Histogram (split: glaucoma_test, 100 documents)</summary>
221
+
222
+ ![img_5.png](img/rtd-label_abs-glu_test.png)
223
+
224
+ </details>
225
+
226
+ ##### mixed_test (100 documents)
227
+
228
+ | | len | max | mean | min | std |
229
+ | :------------- | --: | --: | ------: | --: | ------: |
230
+ | ALL | 658 | 459 | 145.067 | 23 | 77.921 |
231
+ | Attack | 6 | 411 | 164 | 34 | 174.736 |
232
+ | Partial-Attack | 42 | 259 | 65.762 | 23 | 62.426 |
233
+ | Support | 610 | 459 | 150.341 | 35 | 74.273 |
234
+
235
+ <details>
236
+ <summary>Histogram (split: mixed_test, 100 documents)</summary>
237
+
238
+ ![img_6.png](img/rtd-label_abs-mix_test.png)
239
+
240
+ </details>
241
+
242
+ #### Span lengths (tokens)
243
+
244
+ The span length is measured from the first token of the first argumentative unit to the last token of the particular unit.
245
+
246
+ We collect the following statistics: number of documents in the split (*no. doc*), no. of spans (*len*), mean of number of tokens in a span (*mean*), standard deviation of the number of tokens (*std*), minimum tokens in a span (*min*), and maximum tokens in a span (*max*).
247
+ We also present histograms in the collapsible, showing the distribution of these token-numbers (x-axis; and unit-counts in y-axis), accordingly.
248
+
249
+ <details>
250
+ <summary>Command</summary>
251
+
252
+ ```
253
+ python src/evaluate_documents.py dataset=abstrct_base metric=span_lengths_tokens
254
+ ```
255
+
256
+ </details>
257
+
258
+ | statistics | neoplasm_train | neoplasm_dev | neoplasm_test | glaucoma_test | mixed_test |
259
+ | :--------- | -------------: | -----------: | ------------: | ------------: | ---------: |
260
+ | no. doc | 350 | 50 | 100 | 100 | 100 |
261
+ | len | 2267 | 326 | 686 | 594 | 600 |
262
+ | mean | 34.303 | 37.135 | 32.566 | 38.997 | 38.507 |
263
+ | std | 22.425 | 29.941 | 20.264 | 22.604 | 24.036 |
264
+ | min | 5 | 5 | 6 | 6 | 7 |
265
+ | max | 250 | 288 | 182 | 169 | 159 |
266
+
267
+ <details>
268
+ <summary>Histogram (split: neoplasm_train, 350 documents)</summary>
269
+
270
+ ![slt_abs-neo_train.png](img%2Fslt_abs-neo_train.png)
271
+
272
+ </details>
273
+ <details>
274
+ <summary>Histogram (split: neoplasm_dev, 50 documents)</summary>
275
+
276
+ ![slt_abs-neo_dev.png](img%2Fslt_abs-neo_dev.png)
277
+
278
+ </details>
279
+ <details>
280
+ <summary>Histogram (split: neoplasm_test, 100 documents)</summary>
281
+
282
+ ![slt_abs-neo_test.png](img%2Fslt_abs-neo_test.png)
283
+
284
+ </details>
285
+ <details>
286
+ <summary>Histogram (split: glucoma_test, 100 documents)</summary>
287
+
288
+ ![slt_abs-glu_test.png](img%2Fslt_abs-glu_test.png)
289
+
290
+ </details>
291
+ <details>
292
+ <summary>Histogram (split: mixed_test, 100 documents)</summary>
293
+
294
+ ![slt_abs-mix_test.png](img%2Fslt_abs-mix_test.png)
295
+
296
+ </details>
297
+
298
+ #### Token length (tokens)
299
+
300
+ The token length is measured from the first token of the document to the last one.
301
+
302
+ We collect the following statistics: number of documents in the split (*no. doc*), mean of document token-length (*mean*), standard deviation of the length (*std*), minimum number of tokens in a document (*min*), and maximum number of tokens in a document (*max*).
303
+ We also present histograms in the collapsible, showing the distribution of these token lengths (x-axis; and unit-counts in y-axis), accordingly.
304
+
305
+ <details>
306
+ <summary>Command</summary>
307
+
308
+ ```
309
+ python src/evaluate_documents.py dataset=abstrct_base metric=count_text_tokens
310
+ ```
311
+
312
+ </details>
313
+
314
+ | statistics | neoplasm_train | neoplasm_dev | neoplasm_test | glaucoma_test | mixed_test |
315
+ | :--------- | -------------: | -----------: | ------------: | ------------: | ---------: |
316
+ | no. doc | 350 | 50 | 100 | 100 | 100 |
317
+ | mean | 447.291 | 481.66 | 442.79 | 456.78 | 450.29 |
318
+ | std | 91.266 | 116.239 | 89.692 | 115.535 | 87.002 |
319
+ | min | 301 | 329 | 292 | 212 | 268 |
320
+ | max | 843 | 952 | 776 | 1022 | 776 |
321
+
322
+ <details>
323
+ <summary>Histogram (split: neoplasm_train, 350 documents)</summary>
324
+
325
+ ![tl_abs-neo_train.png](img%2Ftl_abs-neo_train.png)
326
+
327
+ </details>
328
+ <details>
329
+ <summary>Histogram (split: neoplasm_dev, 50 documents)</summary>
330
+
331
+ ![tl_abs-neo_dev.png](img%2Ftl_abs-neo_dev.png)
332
+
333
+ </details>
334
+ <details>
335
+ <summary>Histogram (split: neoplasm_test, 100 documents)</summary>
336
+
337
+ ![tl_abs-neo_test.png](img%2Ftl_abs-neo_test.png)
338
+
339
+ </details>
340
+ <details>
341
+ <summary>Histogram (split: glucoma_test, 100 documents)</summary>
342
+
343
+ ![tl_abs-glu_test.png](img%2Ftl_abs-glu_test.png)
344
+
345
+ </details>
346
+ <details>
347
+ <summary>Histogram (split: mixed_test, 100 documents)</summary>
348
+
349
+ ![tl_abs-mix_test.png](img%2Ftl_abs-mix_test.png)
350
+
351
+ </details>
352
+
353
  ## Dataset Creation
354
 
355
  ### Curation Rationale
img/abstr-sam.png ADDED

Git LFS Details

  • SHA256: 92a131b493c7241ec7655527aa9f8e2a34ef3f5b16d0b3209b3facd45ef072f3
  • Pointer size: 130 Bytes
  • Size of remote file: 72.6 kB
img/rtd-label_abs-glu_test.png ADDED

Git LFS Details

  • SHA256: 0f1cf52df2a45e667ffe51b865357bd41323b092e55b660be8ab2e03e1b58c3d
  • Pointer size: 130 Bytes
  • Size of remote file: 17.1 kB
img/rtd-label_abs-mix_test.png ADDED

Git LFS Details

  • SHA256: d81e7adf55fd85efb8e56209427a628a1df9c9964a46b6b6c0bdf1d6b4fbd15b
  • Pointer size: 130 Bytes
  • Size of remote file: 15.6 kB
img/rtd-label_abs-neo_dev.png ADDED

Git LFS Details

  • SHA256: a146942d7b944ca367a8504d9d64a21feba8c8c7b49cf1d10d038d41c64972cb
  • Pointer size: 130 Bytes
  • Size of remote file: 14.9 kB
img/rtd-label_abs-neo_test.png ADDED

Git LFS Details

  • SHA256: 3d8fa46a5d6e1bb6af6643f07d1cdf8efc60ac4043cc7f006bb44351d964f15f
  • Pointer size: 130 Bytes
  • Size of remote file: 17.2 kB
img/rtd-label_abs-neo_train.png ADDED

Git LFS Details

  • SHA256: 89d4455bc020a70fc1a9dba4fe65e74b87da9a494208799d7084f5d00f046c14
  • Pointer size: 130 Bytes
  • Size of remote file: 17.3 kB
img/slt_abs-glu_test.png ADDED

Git LFS Details

  • SHA256: 698481cf60a2f098b47199e3aa3c54e4386cf9c7c1edd23388b9c9b71b3b946b
  • Pointer size: 130 Bytes
  • Size of remote file: 11.4 kB
img/slt_abs-mix_test.png ADDED

Git LFS Details

  • SHA256: 933b8a0445cb72b69adc3dc74bbba3142a74c782c9330cd4292f2ebf39497bb7
  • Pointer size: 130 Bytes
  • Size of remote file: 12.8 kB
img/slt_abs-neo_dev.png ADDED

Git LFS Details

  • SHA256: b4c7cf5ae6fc2c1f0e1926a5e532895bb4d1999cdbfd5f635f966f7fb553f486
  • Pointer size: 130 Bytes
  • Size of remote file: 12.2 kB
img/slt_abs-neo_test.png ADDED

Git LFS Details

  • SHA256: 98b4ab7bf07d1b2b64f9209f6012aa4405ab6d1e75b960474262fa516b301452
  • Pointer size: 130 Bytes
  • Size of remote file: 11.1 kB
img/slt_abs-neo_train.png ADDED

Git LFS Details

  • SHA256: 4bcd839531d3b298a75cdbe4c5a34fa4bf04da723ed39fdd0ff8c3dbae00b3a4
  • Pointer size: 130 Bytes
  • Size of remote file: 13 kB
img/tl_abs-glu_test.png ADDED

Git LFS Details

  • SHA256: 386d04091baa98bb7a9ad8c4ab13759b47f7a23ba6e36ada1a4134402f1863b3
  • Pointer size: 130 Bytes
  • Size of remote file: 11.7 kB
img/tl_abs-mix_test.png ADDED

Git LFS Details

  • SHA256: f00a17c1c65a0be51ffbf11c6abd8418f0172c2b2fe2a46fb3b7454c68220bbd
  • Pointer size: 130 Bytes
  • Size of remote file: 12 kB
img/tl_abs-neo_dev.png ADDED

Git LFS Details

  • SHA256: 994eb93cb40f8b90e891c9aabdb471c4bfe3aaf46cdf3446523b78ae9f2d53be
  • Pointer size: 130 Bytes
  • Size of remote file: 11.7 kB
img/tl_abs-neo_test.png ADDED

Git LFS Details

  • SHA256: 63ed91993fbf1c6aef942d6e4c3dc4731a785a074096e2f6aee56ab81443b436
  • Pointer size: 130 Bytes
  • Size of remote file: 12.1 kB
img/tl_abs-neo_train.png ADDED

Git LFS Details

  • SHA256: 846fbe5dd6cb1dcec8dbe0ad1ceb504c371c7b1db524f8822399318f27c62a61
  • Pointer size: 130 Bytes
  • Size of remote file: 12 kB
requirements.txt CHANGED
@@ -1 +1 @@
1
- pie-datasets>=0.4.0,<0.9.0
 
1
+ pie-datasets>=0.4.0,<0.11.0