Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
Tags:
long context
Commit
•
d4bf86d
1
Parent(s):
f9bd921
Convert dataset to Parquet (#4)
Browse files- Convert dataset to Parquet (dd4b501bca3abd85f4fde8494a1fb2313c2946dd)
- Add 'no_ref' config data files (93a8b118060952c75d8d6f49f0e406d0f2584f78)
- Delete loading script (fe89f60e6168751ec4b1b12a27cab978ce73ea48)
- Delete data file (286935cb7ccdff495f24d75c73c41c005355a50e)
- Delete data file (eb788d442d5206f2440755ed733e87e58b72d6be)
- Delete data file (bdc4e4e2b7a2049731af13d9564bb08f817a9c62)
- README.md +83 -3
- arxiv-classification.py +0 -112
- test_data.txt → data/test-00000-of-00001.parquet +2 -2
- val_data.txt → data/train-00000-of-00004.parquet +2 -2
- train_data.txt → data/train-00001-of-00004.parquet +2 -2
- data/train-00002-of-00004.parquet +3 -0
- data/train-00003-of-00004.parquet +3 -0
- data/validation-00000-of-00001.parquet +3 -0
- no_ref/test-00000-of-00001.parquet +3 -0
- no_ref/train-00000-of-00004.parquet +3 -0
- no_ref/train-00001-of-00004.parquet +3 -0
- no_ref/train-00002-of-00004.parquet +3 -0
- no_ref/train-00003-of-00004.parquet +3 -0
- no_ref/validation-00000-of-00001.parquet +3 -0
README.md
CHANGED
@@ -1,13 +1,93 @@
|
|
1 |
---
|
2 |
language: en
|
|
|
3 |
task_categories:
|
4 |
- text-classification
|
5 |
-
tags:
|
6 |
-
- long context
|
7 |
task_ids:
|
8 |
- multi-class-classification
|
9 |
- topic-classification
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
---
|
12 |
|
13 |
**Arxiv Classification: a classification of Arxiv Papers (11 classes).**
|
|
|
1 |
---
|
2 |
language: en
|
3 |
+
size_categories: 10K<n<100K
|
4 |
task_categories:
|
5 |
- text-classification
|
|
|
|
|
6 |
task_ids:
|
7 |
- multi-class-classification
|
8 |
- topic-classification
|
9 |
+
tags:
|
10 |
+
- long context
|
11 |
+
dataset_info:
|
12 |
+
- config_name: default
|
13 |
+
features:
|
14 |
+
- name: text
|
15 |
+
dtype: string
|
16 |
+
- name: label
|
17 |
+
dtype:
|
18 |
+
class_label:
|
19 |
+
names:
|
20 |
+
'0': math.AC
|
21 |
+
'1': cs.CV
|
22 |
+
'2': cs.AI
|
23 |
+
'3': cs.SY
|
24 |
+
'4': math.GR
|
25 |
+
'5': cs.CE
|
26 |
+
'6': cs.PL
|
27 |
+
'7': cs.IT
|
28 |
+
'8': cs.DS
|
29 |
+
'9': cs.NE
|
30 |
+
'10': math.ST
|
31 |
+
splits:
|
32 |
+
- name: train
|
33 |
+
num_bytes: 1650691690
|
34 |
+
num_examples: 28388
|
35 |
+
- name: validation
|
36 |
+
num_bytes: 144469423
|
37 |
+
num_examples: 2500
|
38 |
+
- name: test
|
39 |
+
num_bytes: 141183324
|
40 |
+
num_examples: 2500
|
41 |
+
download_size: 1011043995
|
42 |
+
dataset_size: 1936344437
|
43 |
+
- config_name: no_ref
|
44 |
+
features:
|
45 |
+
- name: text
|
46 |
+
dtype: string
|
47 |
+
- name: label
|
48 |
+
dtype:
|
49 |
+
class_label:
|
50 |
+
names:
|
51 |
+
'0': math.AC
|
52 |
+
'1': cs.CV
|
53 |
+
'2': cs.AI
|
54 |
+
'3': cs.SY
|
55 |
+
'4': math.GR
|
56 |
+
'5': cs.CE
|
57 |
+
'6': cs.PL
|
58 |
+
'7': cs.IT
|
59 |
+
'8': cs.DS
|
60 |
+
'9': cs.NE
|
61 |
+
'10': math.ST
|
62 |
+
splits:
|
63 |
+
- name: train
|
64 |
+
num_bytes: 1650587077
|
65 |
+
num_examples: 28388
|
66 |
+
- name: validation
|
67 |
+
num_bytes: 144460101
|
68 |
+
num_examples: 2500
|
69 |
+
- name: test
|
70 |
+
num_bytes: 141174323
|
71 |
+
num_examples: 2500
|
72 |
+
download_size: 1010911333
|
73 |
+
dataset_size: 1936221501
|
74 |
+
configs:
|
75 |
+
- config_name: default
|
76 |
+
data_files:
|
77 |
+
- split: train
|
78 |
+
path: data/train-*
|
79 |
+
- split: validation
|
80 |
+
path: data/validation-*
|
81 |
+
- split: test
|
82 |
+
path: data/test-*
|
83 |
+
- config_name: no_ref
|
84 |
+
data_files:
|
85 |
+
- split: train
|
86 |
+
path: no_ref/train-*
|
87 |
+
- split: validation
|
88 |
+
path: no_ref/validation-*
|
89 |
+
- split: test
|
90 |
+
path: no_ref/test-*
|
91 |
---
|
92 |
|
93 |
**Arxiv Classification: a classification of Arxiv Papers (11 classes).**
|
arxiv-classification.py
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import os
|
3 |
-
|
4 |
-
import datasets
|
5 |
-
from datasets.tasks import TextClassification
|
6 |
-
|
7 |
-
_CITATION = None
|
8 |
-
|
9 |
-
|
10 |
-
_DESCRIPTION = """
|
11 |
-
Arxiv Classification Dataset: a classification of Arxiv Papers (11 classes).
|
12 |
-
It contains 11 slightly unbalanced classes, 33k Arxiv Papers divided into 3 splits: train (23k), val (5k) and test (5k).
|
13 |
-
Copied from "Long Document Classification From Local Word Glimpses via Recurrent Attention Learning" by JUN HE LIQUN WANG LIU LIU, JIAO FENG AND HAO WU
|
14 |
-
See: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8675939
|
15 |
-
See: https://github.com/LiqunW/Long-document-dataset
|
16 |
-
"""
|
17 |
-
|
18 |
-
_LABELS = [
|
19 |
-
"math.AC",
|
20 |
-
"cs.CV",
|
21 |
-
"cs.AI",
|
22 |
-
"cs.SY",
|
23 |
-
"math.GR",
|
24 |
-
"cs.CE",
|
25 |
-
"cs.PL",
|
26 |
-
"cs.IT",
|
27 |
-
"cs.DS",
|
28 |
-
"cs.NE",
|
29 |
-
"math.ST"
|
30 |
-
]
|
31 |
-
|
32 |
-
|
33 |
-
class ArxivClassificationConfig(datasets.BuilderConfig):
|
34 |
-
"""BuilderConfig for ArxivClassification."""
|
35 |
-
|
36 |
-
def __init__(self, **kwargs):
|
37 |
-
"""BuilderConfig for ArxivClassification.
|
38 |
-
Args:
|
39 |
-
**kwargs: keyword arguments forwarded to super.
|
40 |
-
"""
|
41 |
-
super(ArxivClassificationConfig, self).__init__(**kwargs)
|
42 |
-
|
43 |
-
|
44 |
-
class ArxivClassificationDataset(datasets.GeneratorBasedBuilder):
|
45 |
-
"""ArxivClassification Dataset: classification of Arxiv Papers (11 classes)."""
|
46 |
-
|
47 |
-
_DOWNLOAD_URL = "https://huggingface.co/datasets/ccdv/arxiv-classification/resolve/main/"
|
48 |
-
_TRAIN_FILE = "train_data.txt"
|
49 |
-
_VAL_FILE = "val_data.txt"
|
50 |
-
_TEST_FILE = "test_data.txt"
|
51 |
-
_LABELS_DICT = {label: i for i, label in enumerate(_LABELS)}
|
52 |
-
|
53 |
-
BUILDER_CONFIGS = [
|
54 |
-
ArxivClassificationConfig(
|
55 |
-
name="default",
|
56 |
-
version=datasets.Version("1.0.0"),
|
57 |
-
description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
|
58 |
-
),
|
59 |
-
ArxivClassificationConfig(
|
60 |
-
name="no_ref",
|
61 |
-
version=datasets.Version("1.0.0"),
|
62 |
-
description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
|
63 |
-
),
|
64 |
-
]
|
65 |
-
|
66 |
-
DEFAULT_CONFIG_NAME = "default"
|
67 |
-
|
68 |
-
def _info(self):
|
69 |
-
return datasets.DatasetInfo(
|
70 |
-
description=_DESCRIPTION,
|
71 |
-
features=datasets.Features(
|
72 |
-
{
|
73 |
-
"text": datasets.Value("string"),
|
74 |
-
"label": datasets.features.ClassLabel(names=_LABELS),
|
75 |
-
}
|
76 |
-
),
|
77 |
-
supervised_keys=None,
|
78 |
-
citation=_CITATION,
|
79 |
-
task_templates=[TextClassification(
|
80 |
-
text_column="text", label_column="label")],
|
81 |
-
)
|
82 |
-
|
83 |
-
def _split_generators(self, dl_manager):
|
84 |
-
train_path = dl_manager.download_and_extract(self._TRAIN_FILE)
|
85 |
-
val_path = dl_manager.download_and_extract(self._VAL_FILE)
|
86 |
-
test_path = dl_manager.download_and_extract(self._TEST_FILE)
|
87 |
-
|
88 |
-
return [
|
89 |
-
datasets.SplitGenerator(
|
90 |
-
name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
|
91 |
-
),
|
92 |
-
datasets.SplitGenerator(
|
93 |
-
name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}
|
94 |
-
),
|
95 |
-
datasets.SplitGenerator(
|
96 |
-
name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}
|
97 |
-
),
|
98 |
-
]
|
99 |
-
|
100 |
-
def _generate_examples(self, filepath):
|
101 |
-
"""Generate ArxivClassification examples."""
|
102 |
-
with open(filepath, encoding="utf-8") as f:
|
103 |
-
for id_, row in enumerate(f):
|
104 |
-
data = json.loads(row)
|
105 |
-
label = self._LABELS_DICT[data["label"]]
|
106 |
-
text = data["text"]
|
107 |
-
|
108 |
-
if self.config.name == "no_ref":
|
109 |
-
for _ in _LABELS:
|
110 |
-
text = text.replace(_, "")
|
111 |
-
|
112 |
-
yield id_, {"text": text, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_data.txt → data/test-00000-of-00001.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b147b8bf40ea7d6ee69467661c34aee2c625de4c463344b12d9d60cdb37afbe2
|
3 |
+
size 73951433
|
val_data.txt → data/train-00000-of-00004.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1d357e46e6a88ea42bee64a2fa5a552b1f526cbd4fab1e7711db563e3d4a139f
|
3 |
+
size 218049486
|
train_data.txt → data/train-00001-of-00004.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dc4844d9889a45b2c0f12cb48b62481c62b5c5d99d7c59d77719d8d934a4876d
|
3 |
+
size 214618189
|
data/train-00002-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f924eaa25dd6be15adbac36e97c05b0346dd6a84a675edcbaa48025927121f2
|
3 |
+
size 215214921
|
data/train-00003-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:382f9a6cd945997a77e696b172907ab1f2d99cb40d8096e8273965eae2ed37a7
|
3 |
+
size 213805988
|
data/validation-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eaad5f33dd0a41ac162253cf8ea9341ffe5000dffe6024d30605850f63c85cff
|
3 |
+
size 75403978
|
no_ref/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:96d76da588e01cb1b35caf8e584d172f50bbb8fda95ed1935c6d8b6e3c038ef7
|
3 |
+
size 73953011
|
no_ref/train-00000-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:34500e9506e5ae2a90154a0b6ad62613234299cdde196bc6d04259e73e771a58
|
3 |
+
size 218009075
|
no_ref/train-00001-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1d8f047edc65bc51a39fb2736b71f1dc91026c7afa29e85223bcb67752ec2119
|
3 |
+
size 214591162
|
no_ref/train-00002-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5b11d5e35c9ff043faba13f8b11629366dccf9613f65e397d8aecb3773c4acd7
|
3 |
+
size 215180805
|
no_ref/train-00003-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:735e772f07c330309f9c5d425e43583ef2e6b8974f27e4e844ccf281a493e9c7
|
3 |
+
size 213783300
|
no_ref/validation-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7f2fc9ae9aba49fd2dbeae564b52e439ae8ae035cc99efccbb9d3c1790877129
|
3 |
+
size 75393980
|