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
+
This repository contains **datasets used in the Pharmaco-Explainer project**.
|
| 7 |
+
They are shared separately on Hugging Face and are used by the training and
|
| 8 |
+
experimentation code hosted on GitHub:
|
| 9 |
+
|
| 10 |
+
π **Training code and scripts:**
|
| 11 |
+
https://github.com/AdamSulek/pharmaco-explainer/
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## Available Datasets
|
| 16 |
+
|
| 17 |
+
The following datasets are available:
|
| 18 |
+
- **k3**
|
| 19 |
+
- **k4**
|
| 20 |
+
- **k5**
|
| 21 |
+
|
| 22 |
+
Each dataset consists of three files:
|
| 23 |
+
|
| 24 |
+
- `<dataset>.parquet` β main feature data
|
| 25 |
+
- `<dataset>_split.parquet` β predefined train/val/test split
|
| 26 |
+
- `<dataset>_labels.parquet` β labels
|
| 27 |
+
|
| 28 |
+
Repository structure:
|
| 29 |
+
```
|
| 30 |
+
k3/
|
| 31 |
+
βββ k3.parquet
|
| 32 |
+
βββ k3_split.parquet
|
| 33 |
+
βββ k3_labels.parquet
|
| 34 |
+
k4/
|
| 35 |
+
βββ k4.parquet
|
| 36 |
+
βββ k4_split.parquet
|
| 37 |
+
βββ k4_labels.parquet
|
| 38 |
+
k5/
|
| 39 |
+
βββ k5.parquet
|
| 40 |
+
βββ k5_split.parquet
|
| 41 |
+
βββ k5_labels.parquet
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
## Downloading the Data
|
| 46 |
+
|
| 47 |
+
Datasets can be downloaded **directly from Hugging Face** using the Python
|
| 48 |
+
script below.
|
| 49 |
+
|
| 50 |
+
### Requirements
|
| 51 |
+
|
| 52 |
+
- Python β₯ 3.8
|
| 53 |
+
- `requests`
|
| 54 |
+
- Environment variable `PHARM_PROJECT_ROOT` pointing to the project root
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
export PHARM_PROJECT_ROOT=/path/to/project
|
| 58 |
+
Download Script
|
| 59 |
+
python
|
| 60 |
+
Skopiuj kod
|
| 61 |
+
import argparse
|
| 62 |
+
from pathlib import Path
|
| 63 |
+
import requests
|
| 64 |
+
import os
|
| 65 |
+
|
| 66 |
+
def project_path(*parts):
|
| 67 |
+
root = os.environ.get("PHARM_PROJECT_ROOT")
|
| 68 |
+
if root is None:
|
| 69 |
+
raise RuntimeError(
|
| 70 |
+
"Environment variable PHARM_PROJECT_ROOT is not set.\n"
|
| 71 |
+
"Run:\n"
|
| 72 |
+
" export PHARM_PROJECT_ROOT=/path/to/project"
|
| 73 |
+
)
|
| 74 |
+
return os.path.join(root, *parts)
|
| 75 |
+
|
| 76 |
+
def download_file(url, dest_path: Path):
|
| 77 |
+
dest_path.parent.mkdir(parents=True, exist_ok=True)
|
| 78 |
+
if dest_path.exists():
|
| 79 |
+
print(f"File already exists, skipping: {dest_path}")
|
| 80 |
+
return
|
| 81 |
+
print(f"Downloading {url} -> {dest_path}")
|
| 82 |
+
r = requests.get(url, stream=True)
|
| 83 |
+
r.raise_for_status()
|
| 84 |
+
with open(dest_path, "wb") as f:
|
| 85 |
+
for chunk in r.iter_content(chunk_size=1024 * 1024):
|
| 86 |
+
if chunk:
|
| 87 |
+
f.write(chunk)
|
| 88 |
+
|
| 89 |
+
def download_dataset(dataset_name):
|
| 90 |
+
base_url = (
|
| 91 |
+
f"https://huggingface.co/datasets/"
|
| 92 |
+
f"klimczakjakubdev/pharmaco-explainer/resolve/main/{dataset_name}/"
|
| 93 |
+
)
|
| 94 |
+
files = [
|
| 95 |
+
f"{dataset_name}.parquet",
|
| 96 |
+
f"{dataset_name}_split.parquet",
|
| 97 |
+
f"{dataset_name}_labels.parquet",
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
dest_dir = Path(project_path("data", dataset_name))
|
| 101 |
+
for file_name in files:
|
| 102 |
+
url = base_url + file_name
|
| 103 |
+
dest_path = dest_dir / file_name
|
| 104 |
+
download_file(url, dest_path)
|
| 105 |
+
|
| 106 |
+
if __name__ == "__main__":
|
| 107 |
+
parser = argparse.ArgumentParser()
|
| 108 |
+
parser.add_argument(
|
| 109 |
+
"--dataset",
|
| 110 |
+
type=str,
|
| 111 |
+
default="k3",
|
| 112 |
+
choices=["k3", "k4", "k5"],
|
| 113 |
+
help="Which dataset to download"
|
| 114 |
+
)
|
| 115 |
+
args = parser.parse_args()
|
| 116 |
+
|
| 117 |
+
download_dataset(args.dataset)
|
| 118 |
+
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Example Usage
|
| 122 |
+
```
|
| 123 |
+
python download_dataset.py --dataset k4
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
Files will be downloaded to:
|
| 127 |
+
```
|
| 128 |
+
$PHARM_PROJECT_ROOT/data/k4/
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## Related Repository
|
| 132 |
+
These datasets are used by the main Pharmaco-Explainer codebase:
|
| 133 |
+
|
| 134 |
+
π https://github.com/AdamSulek/pharmaco-explainer/
|
| 135 |
+
|
| 136 |
+
That repository contains:
|
| 137 |
+
|
| 138 |
+
* model training code
|
| 139 |
+
* experiment configurations
|
| 140 |
+
* preprocessing scripts
|
| 141 |
+
* evaluation and explainability pipelines
|
| 142 |
+
|
pharmaco_explainer_data.parquet
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:28f863f9bb84976a1c694f1adb42e5e8aceb5dcde2be7c297dd041f9a8bb55e6
|
| 3 |
-
size 193568501
|
|
|
|
|
|
|
|
|
|
|
|