|
--- |
|
version: 1.1.0 |
|
icense: cc-by-sa-4.0 |
|
task_categories: |
|
- tabular-classification |
|
language: |
|
- en |
|
tags: |
|
- molecular data |
|
- few-shot learning |
|
pretty_name: FS-Mol |
|
size_categories: |
|
- 1M<n<10M |
|
dataset_summary: FSMol is a dataset curated from ChEMBL27 for small molecule activity |
|
prediction. It consists of 5,120 distinct assays and includes a total of 233,786 |
|
unique compounds. |
|
citation: ' @article{stanley2021fs, title={FS-Mol: A Few-Shot Learning Dataset of |
|
Molecules}, author={Stanley, Matthew and Ramsundar, Bharath and Kearnes, Steven |
|
and Riley, Patrick}, journal={NeurIPS 2021 AI for Science Workshop}, year={2021}, |
|
url={https://www.microsoft.com/en-us/research/publication/fs-mol-a-few-shot-learning-dataset-of-molecules/} |
|
} ' |
|
configs: |
|
- config_name: FSMol |
|
data_files: |
|
- split: train |
|
path: FSMol/train-* |
|
- split: test |
|
path: FSMol/test-* |
|
- split: validation |
|
path: FSMol/validation-* |
|
dataset_info: |
|
config_name: FSMol |
|
features: |
|
- name: SMILES |
|
dtype: string |
|
- name: Y |
|
dtype: int64 |
|
- name: Assay_ID |
|
dtype: string |
|
- name: RegressionProperty |
|
dtype: float64 |
|
- name: LogRegressionProperty |
|
dtype: float64 |
|
- name: Relation |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 490290719 |
|
num_examples: 5026257 |
|
- name: test |
|
num_bytes: 5347524 |
|
num_examples: 56093 |
|
- name: validation |
|
num_bytes: 1816208 |
|
num_examples: 18990 |
|
download_size: 154029966 |
|
dataset_size: 497454451 |
|
--- |
|
# FS-Mol |
|
|
|
[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. |
|
It consists of 5,120 distinct assays and includes a total of 233,786 unique compounds. |
|
This is a mirror of the [Official Github repo](https://github.com/microsoft/FS-Mol) where the dataset was uploaded in 2021. |
|
|
|
|
|
## Preprocessing |
|
[Update 2025.08.16 Version 1.1.0] |
|
We removed invalid SMILES strings from the dataset, which could not be parsed by RDKit. |
|
- Train split: removed 12470 strings from 5038727 strings |
|
- Test split: removed 127 strings from 56220 strings |
|
- Validation split: removed 18 strings from 19008 strings |
|
|
|
|
|
We utilized the raw data uploaded on [Github](https://github.com/microsoft/FS-Mol) and performed several preprocessing: |
|
1. Sanitize the molecules using RDKit and MolVS (standardize SMILES format) |
|
2. Formatting (Combine jsonl.gz files to one csv/parquet file) |
|
3. Rename the columns ('Property' to 'Y') |
|
4. Convert the floats in 'Y' column to integers |
|
5. Split the dataset (train, test, validation) |
|
|
|
If you would like to try our pre-processing steps, run our [script](https://huggingface.co/datasets/maomlab/FSMol/blob/main/FSMol_preprocessing.py). |
|
|
|
|
|
## Quickstart Usage |
|
### Load a dataset in python |
|
Each subset can be loaded into python using the Huggingface [datasets](https://huggingface.co/docs/datasets/index) library. |
|
First, from the command line install the `datasets` library |
|
|
|
$ pip install datasets |
|
|
|
then, from within python load the datasets library |
|
|
|
>>> import datasets |
|
|
|
and load the `FSMol` datasets, e.g., |
|
|
|
>>> FSMol = datasets.load_dataset("maomlab/FSMol", name = "FSMol") |
|
train-00000-of-00001.parquet: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 152M/152M [00:03<00:00, 39.4MB/s] |
|
test-00000-of-00001.parquet: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 1.54M/1.54M [00:00<00:00, 33.3MB/s] |
|
validation-00000-of-00001.parquet: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 517k/517k [00:00<00:00, 52.6MB/s] |
|
Generating train split: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 5038727/5038727 [00:08<00:00, 600413.56 examples/s] |
|
Generating test split: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 56220/56220 [00:00<00:00, 974722.00 examples/s] |
|
Generating validation split: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 19008/19008 [00:00<00:00, 871143.71 examples/s] |
|
|
|
and inspecting the loaded dataset |
|
|
|
>>> FSMol |
|
DatasetDict({ |
|
train: Dataset({ |
|
features: ['SMILES', 'Y', 'Assay_ID', 'RegressionProperty', 'LogRegressionProperty', 'Relation'], |
|
num_rows: 5026257 |
|
}) |
|
test: Dataset({ |
|
features: ['SMILES', 'Y', 'Assay_ID', 'RegressionProperty', 'LogRegressionProperty', 'Relation'], |
|
num_rows: 56093 |
|
}) |
|
validation: Dataset({ |
|
features: ['SMILES', 'Y', 'Assay_ID', 'RegressionProperty', 'LogRegressionProperty', 'Relation'], |
|
num_rows: 18990 |
|
}) |
|
|
|
}) |
|
|
|
### Use a dataset to train a model |
|
One way to use the dataset is through the [MolFlux](https://exscientia.github.io/molflux/) package developed by Exscientia. |
|
First, from the command line, install `MolFlux` library with `catboost` and `rdkit` support |
|
|
|
pip install 'molflux[catboost,rdkit]' |
|
|
|
then load, featurize, split, fit, and evaluate the catboost model |
|
|
|
import json |
|
from datasets import load_dataset |
|
from molflux.datasets import featurise_dataset |
|
from molflux.features import load_from_dicts as load_representations_from_dicts |
|
from molflux.splits import load_from_dict as load_split_from_dict |
|
from molflux.modelzoo import load_from_dict as load_model_from_dict |
|
from molflux.metrics import load_suite |
|
|
|
Split and evaluate the catboost model |
|
|
|
split_dataset = load_dataset('maomlab/FSMol', name = 'FSMol') |
|
|
|
split_featurised_dataset = featurise_dataset( |
|
split_dataset, |
|
column = "SMILES", |
|
representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}])) |
|
|
|
model = load_model_from_dict({ |
|
"name": "cat_boost_classifier", |
|
"config": { |
|
"x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'], |
|
"y_features": ['Y']}}) |
|
|
|
model.train(split_featurised_dataset["train"]) |
|
preds = model.predict(split_featurised_dataset["test"]) |
|
|
|
classification_suite = load_suite("classification") |
|
|
|
scores = classification_suite.compute( |
|
references=split_featurised_dataset["test"]['Y'], |
|
predictions=preds["cat_boost_classifier::Y"]) |
|
|
|
|
|
### Citation |
|
@article{stanley2021fs, |
|
title={FS-Mol: A Few-Shot Learning Dataset of Molecules}, |
|
author={Stanley, Matthew and Ramsundar, Bharath and Kearnes, Steven and Riley, Patrick}, |
|
journal={NeurIPS 2021 AI for Science Workshop}, |
|
year={2021}, |
|
url={https://www.microsoft.com/en-us/research/publication/fs-mol-a-few-shot-learning-dataset-of-molecules/ |
|
|