haneulpark commited on
Commit
5c144a2
·
verified ·
1 Parent(s): 9e92806

Upload 2 files

Browse files
Files changed (2) hide show
  1. README.md +168 -3
  2. gitattributes +59 -0
README.md CHANGED
@@ -1,3 +1,168 @@
1
- ---
2
- license: cc-by-sa-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ task_categories:
4
+ - tabular-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - molecular data
9
+ - few-shot learning
10
+ pretty_name: FS-Mol
11
+ size_categories:
12
+ - 1M<n<10M
13
+ dataset_summary: FSMol is a dataset curated from ChEMBL27 for small molecule activity prediction.
14
+ It consists of 5,120 distinct assays and includes a total of 233,786 unique compounds.
15
+ citation: "
16
+ @article{stanley2021fs,
17
+ title={FS-Mol: A Few-Shot Learning Dataset of Molecules},
18
+ author={Stanley, Matthew and Ramsundar, Bharath and Kearnes, Steven and Riley, Patrick},
19
+ journal={NeurIPS 2021 AI for Science Workshop},
20
+ year={2021},
21
+ url={https://www.microsoft.com/en-us/research/publication/fs-mol-a-few-shot-learning-dataset-of-molecules/}
22
+ } "
23
+ configs:
24
+ - config_name: FSMol
25
+ data_files:
26
+ - split: train
27
+ path: FSMol/train-*
28
+ - split: test
29
+ path: FSMol/test-*
30
+ - split: validation
31
+ path: FSMol/validation-*
32
+ dataset_info:
33
+ config_name: FSMol
34
+ features:
35
+ - name: SMILES
36
+ dtype: string
37
+ - name: 'Y'
38
+ dtype: int64
39
+ description: 'Binary classification (0/1)'
40
+ - name: Assay_ID
41
+ dtype: string
42
+ - name: RegressionProperty
43
+ dtype: float64
44
+ - name: LogRegressionProperty
45
+ dtype: float64
46
+ - name: Relation
47
+ dtype: string
48
+ splits:
49
+ - name: train
50
+ num_bytes: 491639392
51
+ num_examples: 5038727
52
+ - name: test
53
+ num_bytes: 5361196
54
+ num_examples: 56220
55
+ - name: validation
56
+ num_bytes: 1818181
57
+ num_examples: 19008
58
+ download_size: 154453519
59
+ dataset_size: 498818769
60
+
61
+ ---
62
+ # FS-Mol
63
+
64
+ [FS-Mol](https://www.microsoft.com/en-us/research/publication/fs-mol-a-few-shot-learning-dataset-of-molecules/) is a dataset curated from ChEMBL27 for small molecule activity prediction.
65
+ It consists of 5,120 distinct assays and includes a total of 233,786 unique compounds.
66
+ This is a mirror of the [Official Github repo](https://github.com/microsoft/FS-Mol) where the dataset was uploaded in 2021.
67
+
68
+
69
+ ## Preprocessing
70
+
71
+ We utilized the raw data uploaded on [Github](https://github.com/microsoft/FS-Mol) and performed several preprocessing:
72
+ 1. Sanitize the molecules using RDKit and MolVS (standardize SMILES format)
73
+ 2. Formatting (Combine jsonl.gz files to one csv/parquet file)
74
+ 3. Rename the columns ('Property' to 'Y')
75
+ 4. Convert the floats in 'Y' column to integers
76
+ 5. Split the dataset (train, test, validation)
77
+
78
+ If you would like to try our pre-processing steps, run our [script](https://huggingface.co/datasets/maomlab/FSMol/blob/main/FSMol_preprocessing.py).
79
+
80
+
81
+ ## Quickstart Usage
82
+ ### Load a dataset in python
83
+ Each subset can be loaded into python using the Huggingface [datasets](https://huggingface.co/docs/datasets/index) library.
84
+ First, from the command line install the `datasets` library
85
+
86
+ $ pip install datasets
87
+
88
+ then, from within python load the datasets library
89
+
90
+ >>> import datasets
91
+
92
+ and load the `FSMol` datasets, e.g.,
93
+
94
+ >>> FSMol = datasets.load_dataset("maomlab/FSMol", name = "FSMol")
95
+ train-00000-of-00001.parquet: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 152M/152M [00:03<00:00, 39.4MB/s]
96
+ test-00000-of-00001.parquet: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.54M/1.54M [00:00<00:00, 33.3MB/s]
97
+ validation-00000-of-00001.parquet: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 517k/517k [00:00<00:00, 52.6MB/s]
98
+ Generating train split: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5038727/5038727 [00:08<00:00, 600413.56 examples/s]
99
+ Generating test split: 100%|███████████████████████████���███████████████████████████████████████████████████████████████████████████████████████████████████████| 56220/56220 [00:00<00:00, 974722.00 examples/s]
100
+ Generating validation split: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 19008/19008 [00:00<00:00, 871143.71 examples/s]
101
+
102
+ and inspecting the loaded dataset
103
+
104
+ >>> FSMol
105
+ DatasetDict({
106
+ train: Dataset({
107
+ features: ['SMILES', 'Y', 'Assay_ID', 'RegressionProperty', 'LogRegressionProperty', 'Relation'],
108
+ num_rows: 5038727
109
+ })
110
+ test: Dataset({
111
+ features: ['SMILES', 'Y', 'Assay_ID', 'RegressionProperty', 'LogRegressionProperty', 'Relation'],
112
+ num_rows: 56220
113
+ })
114
+ validation: Dataset({
115
+ features: ['SMILES', 'Y', 'Assay_ID', 'RegressionProperty', 'LogRegressionProperty', 'Relation'],
116
+ num_rows: 19008
117
+ })
118
+
119
+ })
120
+
121
+ ### Use a dataset to train a model
122
+ One way to use the dataset is through the [MolFlux](https://exscientia.github.io/molflux/) package developed by Exscientia.
123
+ First, from the command line, install `MolFlux` library with `catboost` and `rdkit` support
124
+
125
+ pip install 'molflux[catboost,rdkit]'
126
+
127
+ then load, featurize, split, fit, and evaluate the catboost model
128
+
129
+ import json
130
+ from datasets import load_dataset
131
+ from molflux.datasets import featurise_dataset
132
+ from molflux.features import load_from_dicts as load_representations_from_dicts
133
+ from molflux.splits import load_from_dict as load_split_from_dict
134
+ from molflux.modelzoo import load_from_dict as load_model_from_dict
135
+ from molflux.metrics import load_suite
136
+
137
+ Split and evaluate the catboost model
138
+
139
+ split_dataset = load_dataset('maomlab/FSMol', name = 'FSMol')
140
+
141
+ split_featurised_dataset = featurise_dataset(
142
+ split_dataset,
143
+ column = "SMILES",
144
+ representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
145
+
146
+ model = load_model_from_dict({
147
+ "name": "cat_boost_classifier",
148
+ "config": {
149
+ "x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
150
+ "y_features": ['Y']}})
151
+
152
+ model.train(split_featurised_dataset["train"])
153
+ preds = model.predict(split_featurised_dataset["test"])
154
+
155
+ classification_suite = load_suite("classification")
156
+
157
+ scores = classification_suite.compute(
158
+ references=split_featurised_dataset["test"]['Y'],
159
+ predictions=preds["cat_boost_classifier::Y"])
160
+
161
+
162
+ ### Citation
163
+ @article{stanley2021fs,
164
+ title={FS-Mol: A Few-Shot Learning Dataset of Molecules},
165
+ author={Stanley, Matthew and Ramsundar, Bharath and Kearnes, Steven and Riley, Patrick},
166
+ journal={NeurIPS 2021 AI for Science Workshop},
167
+ year={2021},
168
+ url={https://www.microsoft.com/en-us/research/publication/fs-mol-a-few-shot-learning-dataset-of-molecules/
gitattributes ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text