lewtun HF Staff commited on
Commit
087e062
·
verified ·
1 Parent(s): a71ab7e

Add balanced 600-example subsets

Browse files

Add binary_600 and mcq_600 configs with 100 seeded examples per subtask, plus the reproducible generation script.

README.md CHANGED
@@ -44,6 +44,50 @@ dataset_info:
44
  num_examples: 2600
45
  download_size: 4880581
46
  dataset_size: 6130755
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  configs:
48
  - config_name: binary
49
  data_files:
@@ -57,4 +101,21 @@ configs:
57
  data_files:
58
  - split: train
59
  path: mcq/eukaryote_cls_mcq.parquet
 
 
 
 
 
 
 
 
60
  ---
 
 
 
 
 
 
 
 
 
 
44
  num_examples: 2600
45
  download_size: 4880581
46
  dataset_size: 6130755
47
+ - config_name: binary_600
48
+ features:
49
+ - name: id
50
+ dtype: int64
51
+ - name: subtask
52
+ dtype: string
53
+ - name: question
54
+ dtype: string
55
+ - name: options
56
+ list: string
57
+ - name: answer_index
58
+ dtype: int64
59
+ - name: answer_text
60
+ dtype: string
61
+ - name: metadata
62
+ dtype: string
63
+ splits:
64
+ - name: train
65
+ num_bytes: 440655
66
+ num_examples: 600
67
+ download_size: 186982
68
+ dataset_size: 440655
69
+ - config_name: mcq_600
70
+ features:
71
+ - name: id
72
+ dtype: int64
73
+ - name: subtask
74
+ dtype: string
75
+ - name: question
76
+ dtype: string
77
+ - name: options
78
+ list: string
79
+ - name: answer_index
80
+ dtype: int64
81
+ - name: answer_text
82
+ dtype: string
83
+ - name: metadata
84
+ dtype: string
85
+ splits:
86
+ - name: train
87
+ num_bytes: 1243475
88
+ num_examples: 600
89
+ download_size: 996782
90
+ dataset_size: 1243475
91
  configs:
92
  - config_name: binary
93
  data_files:
 
101
  data_files:
102
  - split: train
103
  path: mcq/eukaryote_cls_mcq.parquet
104
+ - config_name: binary_600
105
+ data_files:
106
+ - split: train
107
+ path: binary_600/train-*
108
+ - config_name: mcq_600
109
+ data_files:
110
+ - split: train
111
+ path: mcq_600/train-*
112
  ---
113
+
114
+ # Balanced 600-example subsets
115
+
116
+ The `binary_600` and `mcq_600` configurations each contain 100 examples sampled without replacement from each of
117
+ GenomeQA's six subtasks. The combined rows are shuffled so the configurations are not stored in subtask blocks.
118
+
119
+ The subsets were generated with seed 42 from source revision
120
+ `a71ab7e0e72b8eca7acd4475744dccd0159b20be`. See
121
+ [`scripts/create_600_subsets.py`](scripts/create_600_subsets.py) for the reproducible generation script.
binary_600/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90670a01b3f4764c46b0c661cec8c804df62a66933b6b0f8f749b9f403c5426c
3
+ size 186982
mcq_600/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:41b9fbf4880e31ebb2747f3899f5157a46169f717c39ee7adf698c44418a07e8
3
+ size 996782
scripts/create_600_subsets.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Create deterministic 600-example GenomeQA subsets balanced by subtask."""
2
+
3
+ import argparse
4
+ import random
5
+ from collections import Counter
6
+ from pathlib import Path
7
+
8
+ from datasets import load_dataset
9
+
10
+
11
+ DATASET_ID = "HuggingFaceBio/genomeqa"
12
+ SOURCE_REVISION = "a71ab7e0e72b8eca7acd4475744dccd0159b20be"
13
+ SOURCE_CONFIGS = ("binary", "mcq")
14
+ SAMPLES_PER_SUBTASK = 100
15
+ SEED = 42
16
+
17
+
18
+ def create_subset(config: str, output_dir: Path, seed: int) -> None:
19
+ dataset = load_dataset(DATASET_ID, config, split="train", revision=SOURCE_REVISION)
20
+ subtasks = sorted(set(dataset["subtask"]))
21
+ rng = random.Random(f"{seed}:{config}")
22
+ selected_indices = []
23
+
24
+ for subtask in subtasks:
25
+ candidate_indices = [index for index, value in enumerate(dataset["subtask"]) if value == subtask]
26
+ if len(candidate_indices) < SAMPLES_PER_SUBTASK:
27
+ raise ValueError(f"{subtask} has only {len(candidate_indices)} examples")
28
+ selected_indices.extend(rng.sample(candidate_indices, SAMPLES_PER_SUBTASK))
29
+
30
+ rng.shuffle(selected_indices)
31
+ subset = dataset.select(selected_indices)
32
+ expected_counts = dict.fromkeys(subtasks, SAMPLES_PER_SUBTASK)
33
+ if Counter(subset["subtask"]) != expected_counts:
34
+ raise RuntimeError("Generated subset is not balanced by subtask")
35
+
36
+ config_dir = output_dir / f"{config}_600"
37
+ config_dir.mkdir(parents=True, exist_ok=True)
38
+ output_path = config_dir / "train-00000-of-00001.parquet"
39
+ subset.to_parquet(output_path)
40
+
41
+
42
+ def main() -> None:
43
+ parser = argparse.ArgumentParser()
44
+ parser.add_argument("--output-dir", type=Path, default=Path.cwd())
45
+ parser.add_argument("--seed", type=int, default=SEED)
46
+ args = parser.parse_args()
47
+
48
+ for config in SOURCE_CONFIGS:
49
+ create_subset(config, args.output_dir, args.seed)
50
+
51
+
52
+ if __name__ == "__main__":
53
+ main()