Commit 36840b54 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

fhanges

parent 73a5c029
Loading
Loading
Loading
Loading
+48 −11
Original line number Diff line number Diff line
@@ -33,10 +33,7 @@ The :code:`dc.feat.Featurizer` class is the abstract parent class for all featur
MolecularFeaturizer
-------------------

The :code:`dc.feat.MolecularFeaturizer` class is the abstract parent class for all featurizers that work with small molecule data. 

.. autoclass:: deepchem.feat.MolecularFeaturizer
  :members:
Molecular Featurizers are those that work with datasets of molecules.

ConvMolFeaturizer
^^^^^^^^^^^^^^^^^
@@ -74,19 +71,34 @@ CoulombMatrixEig
.. autoclass:: deepchem.feat.CoulombMatrixEig
  :members:

AtomCoordinates
^^^^^^^^^^^^^^^

ReactionFeaturizer
------------------
.. autoclass:: deepchem.feat.AtomicCoordinates
  :members:

The :code:`dc.feat.ReactionFeaturizer` class is the abstract parent class for all featurizers that work with chemical reaction data.
AdjacencyFingerprint
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: deepchem.feat.ReactionFeaturizer
.. autoclass:: deepchem.feat.AdjacencyFingerprint
  :members:

MolecularComplexFeaturizer
--------------------------
SmilesToSeq
^^^^^^^^^^^

The :code:`dc.feat.MolecularComplexFeaturizer` class is the abstract parent class for all featurizers that work with three dimensional molecular complexes. 
.. autoclass:: deepchem.feat.SmilesToSeq
  :members:

SmilesToImage
^^^^^^^^^^^^^

.. autoclass:: deepchem.feat.SmilesToImage
  :members:

ComplexFeaturizer
-----------------

The :code:`dc.feat.ComplexFeaturizer` class is the abstract parent class for all featurizers that work with three dimensional molecular complexes. 


.. autoclass:: deepchem.feat.ComplexFeaturizer
@@ -98,6 +110,19 @@ RdkitGridFeaturizer
.. autoclass:: deepchem.feat.RdkitGridFeaturizer
  :members:

AtomConvFeaturizer
^^^^^^^^^^^^^^^^^^

.. autoclass:: deepchem.feat.NeighborListComplexAtomicCoordinates
  :members:


BindingPocketFeaturizer
-----------------------

.. autoclass:: deepchem.feat.BindingPocketFeaturizer
  :members:

UserDefinedFeaturizer
---------------------

@@ -109,3 +134,15 @@ BPSymmetryFunctionInput

.. autoclass:: deepchem.feat.BPSymmetryFunctionInput
  :members:

OneHotFeaturizer
----------------

.. autoclass:: deepchem.feat.OneHotFeaturizer
  :members:

RawFeaturizer
-------------

.. autoclass:: deepchem.feat.RawFeaturizer
  :members:

docs/hyper.rst

0 → 100644
+27 −0
Original line number Diff line number Diff line
Hyperparameter Tuning
=====================
One of the most important aspects of machine learning is
hyperparameter tuning. Many machine learning models have a number of
hyperparameters that control aspects of the model. These
hyperparameters typically cannot be learned directly by the same
learning algorithm used for the rest of learning and have to be set in
an alternate fashion. The :code:`dc.hyper` module contains utilities
for hyperparameter tuning.

Grid Hyperparameter Optimization
--------------------------------

This is the simplest form of hyperparameter optimization that simply
involves iterating over a fixed grid of possible values for
hyperaparameters.

.. autoclass:: deepchem.hyper.HyperparamOpt
  :members:

Gaussian Process Hyperparameter Optimization
--------------------------------------------

.. autoclass:: deepchem.hyper.GaussianProcessHyperparamOpt
  :members:

+7 −1
Original line number Diff line number Diff line
@@ -122,4 +122,10 @@ discussions about research, development or any general questions. If you'd like
   Splitters <splitters>
   Transformers <transformers>
   Models <models>
   Introduction to Keras <keras>
   Layers <layers>
   Metrics <metrics>
   Hyperparameter Turning <hyper>
   MoleculeNet <moleculenet>
   Metalearning <metalearning>
   Reinforcement Learning <rl>
   Utilities <utils>
+0 −123
Original line number Diff line number Diff line
Keras
=====
DeepChem extensively uses `Keras`_ to build powerful machine learning models.

.. _`Keras`: https://keras.io/

Vocabulary
----------
Let's introduce some vocabulary to get you comfortable with building your own models using DeepChem and Keras.

Sequential Models
-----------------
A sequential Keras  model is about pipeing around series of layers.  Placing your TensorFlow code into a TensorGraph means you don't have to worry about coding methods for fitting, training, and batching data, nor do you need to worry about writing pickling and restoring functions. It also enables beautiful TensorBoard visualizations. 

Layer
-----
A Layer is a node in a graph.  A Layer class has a "name" and a create_tensor function.  create_tensor takes in a list of input Layers, returns a tf.Tensor object, and sets the tf.Tensor object as self.out_tensor.  Below is an example Layer which will reverse the order of the parent Tensor's 0th axis.

.. code-block:: python
  class Reverse(Layer):
    def create_tensor(self, in_layers=None, set_tensors=True, **kwargs):
      parent_out = self._get_input_tensors(in_layers[0], True)
      out_tensor = tf.reverse(parent_out, axis=0)
      if set_tensors:
        self.out_tensor = out_tensor
      return out_tensor

Features
--------
Features are how we feed input data into our model.  During training or predicting, TensorGraph will set the values of feature layers from Dataset.X.  We have to manually tell TensorGraph which layers we want to feed data into.
We can then form a computation graph by combining layers on a TensorGraph. 

.. code-block:: python
  tg = TensorGraph()
  # Convention is to set batch size as 0th axis.
  # None means any batch size is allowed.
  feature = Feature(shape=(None, 5))
  reverse = Reverse(in_layers=[feature]) #From Above

Now during computation, the reverse layer will reverse the feature layer.

Labels
------
Labels are the results we expect to get for each feature.  We feed Dataset.y into a label when "fit"ing a model.

.. code-block:: python
  tf = TensorGraph()
  label = Label(shape=(None, 2)) # Example Binary Classification label

Loss
----
Loss is a scalar we wish to minimize for our network.  When training, we will use TensorFlow to intelligently minimize this value via gradient descent.

.. code-block:: python
  tg = TensorGraph()
  # a is labels for a classification problem
  # b is our guesses for the classification problem
  smce = SoftMaxCrossEntropy(in_layers=[a,b])
  red_mean = ReduceMean(in_layers=[smce])
  tg.set_loss(red_mean)

Here in our classification problem, we are attempting to reduce the mean of a SoftMaxCrossEntropy.

Outputs
-------
Outputs are your predictions for tasks.  A TensorGraph can have multiple outputs, such is the case in a multi-task regression problem.
By convention, regression problems' outputs are single values, while classification problems' outputs are probability vectors,
where each entry represents the probability of the input being in each of the classes.

.. code-block:: python
  tg = TensorGraph()
  # Create your layers
  # a is an output layer
  tg.add_output(a)

Creating your own TensorGraph Model
-----------------------------------

In order to create a TensorGraph model, we have to:
1. Create the TensorGraph model object
2. Add Layers
3. Add Features
4. Add Labels
5. Set Loss

Using TensorBoard with TensorGraph
----------------------------------

Visualizing layers is extremely easy with TensorBoard. After creating
a layer, simply call the set_summary method. 

Tensorgraph currently supports the following summary ops: [histogram](https://www.tensorflow.org/api_docs/python/tf/summary/histogram), [scalar](https://www.tensorflow.org/api_docs/python/tf/summary/scalar), and [tensor_summary](https://www.tensorflow.org/api_docs/python/tf/summary/tensor_summary)

.. code-block:: python
  model_dir='example_dir'
  tg = TensorGraph(model_dir=model_dir)
  # a is a Feature tensor
  dense = Dense(in_layers=[a])
  dense.set_summary(summary_op='histogram')

Then after the model has finished training, simply run

.. code-block:: bash
  tensorboard --logdir=example_dir

Navigate to [localhost:6006](localhost:6006) to view your
visualizations. TensorGraph will also have automatically constructed
the graph visualization.

Examples
--------
[TensorGraph on the MNIST](MNIST.md)

TensorGraph for Bypass MultiTask Classification

Further Reading
---------------

Saving and Restoring TensorGraph

Experimenting on new architectures with TensorGraph

Adding complexity while fighting overfitting

Transfer Learning

docs/layers.rst

0 → 100644
+107 −0
Original line number Diff line number Diff line
Layers
======
Deep learning models are often said to be made up of "layers".
Intuitively, a "layer" is a function which transforms some tensor into
another tensor. DeepChem maintains an extensive collection of layers which perform various useful scientific transformations. For now, most layers are Keras only but over time we expect this support to expand to other types of models and layers.

.. autoclass:: deepchem.models.layers.InteratomicL2Distances
  :members:

.. autoclass:: deepchem.models.layers.GraphConv
  :members:

.. autoclass:: deepchem.models.layers.GraphConv
  :members:

.. autoclass:: deepchem.models.layers.GraphPool
  :members:

.. autoclass:: deepchem.models.layers.GraphGather
  :members:

.. autoclass:: deepchem.models.layers.LSTMStep
  :members:

.. autoclass:: deepchem.models.layers.AttnLSTMEmbedding
  :members:

.. autoclass:: deepchem.models.layers.IterRefLSTMEmbedding
  :members:

.. autoclass:: deepchem.models.layers.SwitchedDropout
  :members:

.. autoclass:: deepchem.models.layers.WeightedLinearCombo
  :members:

.. autoclass:: deepchem.models.layers.CombineMeanStd
  :members:

.. autoclass:: deepchem.models.layers.Stack
  :members:

.. autoclass:: deepchem.models.layers.VinaFreeEnergy
  :members:

.. autoclass:: deepchem.models.layers.NeighborList
  :members:

.. autoclass:: deepchem.models.layers.AtomicConvolution
  :members:

.. autoclass:: deepchem.models.layers.AlphaShareLayer
  :members:
  
.. autoclass:: deepchem.models.layers.SluiceLoss
  :members:
  
.. autoclass:: deepchem.models.layers.BetaShare
  :members:

.. autoclass:: deepchem.models.layers.ANIFeat
  :members:

.. autoclass:: deepchem.models.layers.GraphEmbedPoolLayer
  :members:

.. autoclass:: deepchem.models.layers.GraphCNN
  :members:

.. autoclass:: deepchem.models.layers.Highway
  :members:

.. autoclass:: deepchem.models.layers.WeaveLayer
  :members:

.. autoclass:: deepchem.models.layers.WeaveGather
  :members:

.. autoclass:: deepchem.models.layers.DTNNEmbedding
  :members:

.. autoclass:: deepchem.models.layers.DTNNStep
  :members:

.. autoclass:: deepchem.models.layers.DTNNGather
  :members:

.. autoclass:: deepchem.models.layers.DAGLayer
  :members:

.. autoclass:: deepchem.models.layers.DAGGather
  :members:

.. autoclass:: deepchem.models.layers.MessagePassing
  :members:

.. autoclass:: deepchem.models.layers.EdgeNetwork
  :members:

.. autoclass:: deepchem.models.layers.GatedRecurrentUnit
  :members:

.. autoclass:: deepchem.models.layers.SetGather
  :members:

.. autoclass:: deepchem.models.layers.SetGather
  :members:
Loading