File size: 3,716 Bytes
64a6ac3
 
0337404
64a6ac3
 
0337404
64a6ac3
0337404
 
d063f3e
 
0337404
d063f3e
0337404
 
 
 
 
2cf1cf5
 
 
 
 
 
64a6ac3
 
 
 
2cf1cf5
 
 
 
 
 
 
 
 
 
 
 
 
 
64a6ac3
 
 
 
 
 
 
 
 
 
 
 
 
da21b0d
 
 
 
 
2cf1cf5
 
64a6ac3
19a4c0f
 
 
 
2cf1cf5
 
 
 
 
f7685b7
 
 
 
 
 
 
 
 
 
64a6ac3
 
b1e8bb0
 
 
 
da21b0d
 
b1e8bb0
f597317
 
 
 
 
 
 
 
 
 
b1e8bb0
d063f3e
b1e8bb0
d063f3e
b1e8bb0
64a6ac3
da21b0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
configs:
- config_name: default
  data_files:
  - split: train
    path: "minor/train.json"
  - split: test
    path: "minor/test.json"
- config_name: major
  data_files:
  - split: train
    path: "major/train.json"
  - split: test
    path: "major/test.json"
- config_name: all2023
  data_files:
  - split: val
    path: "all2023/val.json"
- config_name: all2023_v2
  data_files:
  - split: train
    path: "all2023_v2/train.json"
  - split: test
    path: "all2023_v2/test.json"
---

# arXiv Classifier Data

Usage:
```
from datasets import load_dataset, DownloadMode
# download from HuggingFace
dataset = load_dataset('mlcore/arxiv-classifier', name=<CONFIG NAME>)
# load from G2
dataset = load_dataset('/share/nikola/arxiv_classifier/data/arxiv-classifier', name=<CONFIG NAME>)
```
To force the dataset to be re-generated:
```
dataset = load_dataset('/share/nikola/arxiv_classifier/data/arxiv-classifier', name=<CONFIG NAME>, download_mode=DownloadMode.FORCE_REDOWNLOAD)
```
See: https://huggingface.co/docs/datasets/v2.20.0/en/package_reference/builder_classes#datasets.DownloadMode

Standardized terminology:
- Field: Bio/cs/physics
- Subfield: Subcategories within each
    - Primary subfield (bio., cs.LG): Given primary subfield, you can infer the field
    - Secondary subfields: Includes primary subfield, but also includes any subfields that were tagged in the paper (1-5)

Old terminology to standardized terminology translation:
- Prime category = Primary subfield
- Abstract category = secondary subfield
- Major category = field

Original data: https://www.dropbox.com/scl/fo/wwu0ifghw4sco09g67frb/h?rlkey=6ddg3yab9la3zeddvmnsfktxq&e=1&dl=0

**Minor (default)**: Dataset of papers between 2010 and 2020 (with some pre-2010 papers) with balanced primary subfields.

**Major**: Dataset of papers between 2010 and 2020 (with some pre-2010 papers) with unbalanced primary subfields to better represent the true distribution of primary categories, which is dominated by a few subfields. Note that the distribution of major subfields is still truncated.

**All 2023**: All papers published in 2023.
- Train: papers with date between January and June (inclusive)
- Test: papers with date between July and December (inclusive)

![Primary subfield distribution](figures/Primary_subfield_distribution.png)

![Secondary subfield distribution](figures/Secondary_subfield_distribution.png)

To generate subfield distribution plots:
```
python plot_subfield_distributions.py --output_path <path_to_save_plots>
```

## Set up dependencies

Get subfields to ignore and subfield aliases:
```
# in your conda env
git clone https://github.com/ag2435/arxiv-classifier-next
cd arxiv-classifier-next
conda develop .
```

## Preprocessing

Transform raw data into JSON format:
```
# major/minor cats data
python preprocess_major_minor.py -d <DATASET NAME> -s <SPLIT> -op <PATH TO SAVE PREPROCESSED DATA>
# all 2023 corpus (full text)
python preprocess_all2023_v2.py
```

Additional data checks:
```
python test_paper_id.py
```

:white_check_mark: Checked that there is no data leakage between train and test splits for each dataset config

:white_check_mark: Checked validity of arXiv identifiers for each paper

<!-- [4782 Kaggle](https://www.kaggle.com/competitions/cs-4782-2024/overview) code: [4782_preprocess_data.ipynb](4782_preprocess_data.ipynb)

[Internal Kaggle](https://www.kaggle.com/competitions/ar-xive-project-baselines/overview) code: [clean_data_for_hugging_face.ipynb](https://huggingface.co/datasets/mlcore/arxiv-classifier/blob/main/clean_data_for_hugging_face.ipynb) -->

<!-- ## Todo

- Can we incorporate additional metadata (e.g., authors)? Note: author names are contained in the full text-->