Unverified Commit a04773bf authored by micimize's avatar micimize
Browse files

some minor cleanup / corrections

parent 38bf2a34
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -6,7 +6,10 @@ SAMPL models

Some examples of training models on the SAMPL(FreeSolv) dataset included in :code:`dc.molnet`.

First we'll load our tasks, dataset  splits, and transformers from molnet:
We'll be using its ``smiles`` field to train models to predict its experimentally measured solvation energy (``expt``).

First, we'll load our libraries:

.. doctest::

   >>> import numpy as np
@@ -23,6 +26,8 @@ First we'll load our tasks, dataset splits, and transformers from molnet:

   >>> # Load SAMPL dataset
   >>> SAMPL_tasks, SAMPL_datasets, transformers = load_sampl()
   >>> SAMPL_tasks
   ['expt']
   >>> train_dataset, valid_dataset, test_dataset = SAMPL_datasets
   >>>
   >>> # We'll train a multitask regressor (fully connected network)
@@ -36,7 +41,7 @@ First we'll load our tasks, dataset splits, and transformers from molnet:
   ...     learning_rate=0.001,
   ...     batch_size=50)
   >>> 
   >>> # Fit trained model
   >>> # Fit trained model (returns average loss over the most recent checkpoint interval)
   >>> model.fit(train_dataset)
   0.1726440668106079
   >>> 
@@ -53,13 +58,13 @@ For a :code:`GraphConvModel` we'll need to reload with the appropriate featurize
   >>> np.random.seed(123)
   >>> tf.random.set_seed(123)
   >>> # Load SAMPL dataset
   >>> SAMPL_tasks, SAMPL_datasets, transformers = dc.molnet.load_sampl(
   >>> SAMPL_tasks, SAMPL_datasets, transformers = load_sampl(
   ...     featurizer='GraphConv')
   >>> train_dataset, valid_dataset, test_dataset = SAMPL_datasets
   >>>
   >>> model = dc.models.GraphConvModel(len(SAMPL_tasks), mode='regression')
   >>> 
   >>> # Fit trained model
   >>> # Fit trained model (returns average loss over the most recent checkpoint interval)
   >>> model.fit(train_dataset, nb_epoch=20)
   0.05753047466278076
   >>>