Custom utility functions and classes for DL model exploration with DeepChem. Most of them are wrappers to existing DeepChem objects.
- Dataset preparation wrapper for datasets with user-defined splits.
from deepchem_utils.dataset import prepare_dataset
train_dataset, valid_dataset, transformer = prepare_dataset(
filepath=path_to_data, # CSV
model_name="GraphConvModel",
valid_indices=valid_indices,
test_indices=test_indices
)- Hyperparameter optimization wrapper.
import deepchem as dc
from deepchem_utils.model_selection import run_hyperopt_search
f1 = dc.metrics.Metric(dc.metrics.f1_score)
run_hyperopt_search(
model_name="GraphConvModel",
train_dataset=train_dataset,
valid_dataset=valid_dataset,
params_dict=params_dict,
metrics=f1,
output_filepath="data",
transformer=transformer
)- Evaluation of models with optimized hyperparameters using a custom callback to define best number of epochs (pseudo-manual early stopping selection as
deepchemdoes not has an implementation for it).
from deepchem_utils.model_selection import SelectEpochs
experiment = SelectEpochs(
model_name="GraphConvModel",
params=params,
metrics=[f1],
frequency=2,
nb_epoch=100,
output_file="data/GraphConvModel_valid_callback.csv"
)
experiment.repeated_evaluation(train_dataset, valid_dataset, transformer, n_times=5)The content of this repo is licensed under the MIT license conditions.