Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -81,18 +81,69 @@ and load one of the `AttentiveSkin` datasets, e.g.,
|
|
| 81 |
|
| 82 |
>>> AttentiveSkin = datasets.load_dataset("maomlab/AttentiveSkin", name = "AttentiveSkin")
|
| 83 |
Downloading readme:
|
| 84 |
-
4%|▍ | 4.02/100 [00:00<00:00,
|
| 85 |
Downloading data:
|
| 86 |
-
|
| 87 |
Downloading data:
|
| 88 |
-
|
| 89 |
Generating test split:
|
| 90 |
-
|
| 91 |
Generating train split:
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
## AttentiveSkin
|
| 98 |
To Predict Skin Corrosion/Irritation Potentials of Chemicals via Explainable Machine Learning Methods
|
|
|
|
| 81 |
|
| 82 |
>>> AttentiveSkin = datasets.load_dataset("maomlab/AttentiveSkin", name = "AttentiveSkin")
|
| 83 |
Downloading readme:
|
| 84 |
+
4%|▍ | 4.02/100 [00:00<00:00, 39.5kkB/s]
|
| 85 |
Downloading data:
|
| 86 |
+
100%|██████████| 468/468 [00:00<00:00, 4.04MkB/s]
|
| 87 |
Downloading data:
|
| 88 |
+
100%|██████████| 1.41k/1.41k [00:00<00:00, 10.8MkB/s]
|
| 89 |
Generating test split:
|
| 90 |
+
100%|██████████| 803/803 [00:00<00:00, 7.17Mexamples/s]
|
| 91 |
Generating train split:
|
| 92 |
+
100%|██████████| 2.42k/2.42k [00:00<00:00, 6.23Mexamples/s]
|
| 93 |
+
|
| 94 |
+
and inspecting the loaded dataset
|
| 95 |
+
|
| 96 |
+
>>> AttentiveSkin
|
| 97 |
+
AttentiveSkin
|
| 98 |
+
|
| 99 |
+
DatasetDict({
|
| 100 |
+
test: Dataset({
|
| 101 |
+
features: ['Name', 'Synonym', 'CAS RN', 'GHS', 'Detailed Page', 'Evidence', 'OECD TG 404', 'Data Source', 'Frequency', 'SMILES', 'SMILES URL', 'SMILES Source', 'Canonical SMILES', 'Split', 'ClusterNo', 'MolCount', 'group'],
|
| 102 |
+
num_rows: 803
|
| 103 |
+
})
|
| 104 |
+
train: Dataset({
|
| 105 |
+
features: ['Name', 'Synonym', 'CAS RN', 'GHS', 'Detailed Page', 'Evidence', 'OECD TG 404', 'Data Source', 'Frequency', 'SMILES', 'SMILES URL', 'SMILES Source', 'Canonical SMILES', 'Split', 'ClusterNo', 'MolCount', 'group'],
|
| 106 |
+
num_rows: 2416
|
| 107 |
+
})
|
| 108 |
+
})
|
| 109 |
+
|
| 110 |
+
### Use a dataset to train a model
|
| 111 |
+
One way to use the dataset is through the [MolFlux](https://exscientia.github.io/molflux/) package developed by Exscientia.
|
| 112 |
+
First, from the command line, install `MolFlux` library with `catboost` and `rdkit` support
|
| 113 |
+
|
| 114 |
+
pip install 'molflux[catboost,rdkit]'
|
| 115 |
+
|
| 116 |
+
then load, featurize, split, fit, and evaluate the catboost model
|
| 117 |
+
|
| 118 |
+
import json
|
| 119 |
+
from datasets import load_dataset
|
| 120 |
+
from molflux.datasets import featurise_dataset
|
| 121 |
+
from molflux.features import load_from_dicts as load_representations_from_dicts
|
| 122 |
+
from molflux.splits import load_from_dict as load_split_from_dict
|
| 123 |
+
from molflux.modelzoo import load_from_dict as load_model_from_dict
|
| 124 |
+
from molflux.metrics import load_suite
|
| 125 |
+
|
| 126 |
+
split_dataset = load_dataset('maomlab/AttentiveSkin')
|
| 127 |
+
|
| 128 |
+
split_featurised_dataset = featurise_dataset(
|
| 129 |
+
split_dataset,
|
| 130 |
+
column = "SMILES",
|
| 131 |
+
representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
|
| 132 |
+
|
| 133 |
+
model = load_model_from_dict({
|
| 134 |
+
"name": "cat_boost_classifier",
|
| 135 |
+
"config": {
|
| 136 |
+
"x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
|
| 137 |
+
"y_features": ['Solubility']}})
|
| 138 |
+
|
| 139 |
+
model.train(split_featurised_dataset["train"])
|
| 140 |
+
preds = model.predict(split_featurised_dataset["test"])
|
| 141 |
+
|
| 142 |
+
classification_suite = load_suite("classification")
|
| 143 |
+
|
| 144 |
+
scores = classification_suite.compute(
|
| 145 |
+
references=split_featurised_dataset["test"]['Solubility'],
|
| 146 |
+
predictions=preds["cat_boost_classifier::Solubility"])
|
| 147 |
|
| 148 |
## AttentiveSkin
|
| 149 |
To Predict Skin Corrosion/Irritation Potentials of Chemicals via Explainable Machine Learning Methods
|