Commit 5328e3a8 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Merging in upstream changes

parents 221be57b f5218230
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@ Stanford and originally created by [Bharath Ramsundar](http://rbharath.github.io
* [Getting Started](#getting-started)
    * [Input Formats](#input-formats)
    * [Data Featurization](#data-featurization)
* [Contributing to DeepChem](#contributing-to-deepchem)
    * [Code Style Guidelines](#code-style-guidelines)
    * [Documentation Style Guidelines](#documentation-style-guidelines)
* [DeepChem Publications](#deepchem-publications)
* [Examples](/examples)
* [About Us](#about-us)
@@ -199,6 +202,18 @@ featurization class ``DataFeaturizer``. Instances of this class must be
passed a ``Featurizer`` object. ``deepchem`` provides a number of
different subclasses of ``Featurizer`` for convenience:

## Contributing to DeepChem

We actively encourage community contributions to DeepChem. The first place to start getting involved is by running our examples locally. Afterwards, we encourage contributors to give a shot to improving our documentation. While we take effort to provide good docs, there's plenty of room for improvement. All docs are hosted on Github, either in this `README.md` file, or in the `docs/` directory.

Once you've got a sense of how the package works, we encourage the use of Github issues to discuss more complex changes,  raise requests for new features or propose changes to the global architecture of DeepChem. Once consensus is reached on the issue, please submit a PR with proposed modifications. All contributed code to DeepChem will be reviewed by a member of the DeepChem team, so please make sure your code style and documentation style match our guidelines!

### Code Style Guidelines
DeepChem broadly follows the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). In terms of practical changes, the biggest effect is that all code uses 2-space indents instead of 4-space indents. We encourage new contributors to make use of [pylint](https://www.pylint.org/). Aim for a score of at least 8/10 on contributed files.

### Documentation Style Guidelines
DeepChem uses [NumPy style documentation](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt). Please follow these conventions when documenting code, since we use [Sphinx+Napoleon](http://www.sphinx-doc.org/en/stable/ext/napoleon.html) to automatically generate docs on [deepchem.io](deepchem.io). 

## DeepChem Publications
1. [Computational Modeling of β-secretase 1 (BACE-1) Inhibitors using
Ligand Based
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import joblib
import os
import tempfile
import sklearn
from deepchem.datasets import Dataset
from deepchem.datasets import Dataset, pad_features
from deepchem.transformers import undo_transforms
from deepchem.transformers import undo_grad_transforms
from deepchem.utils.save import load_from_disk
+16 −2
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ class TensorflowGraphModel(object):
            log("About to shuffle dataset before epoch start.", self.verbosity)
            dataset.shuffle()
          for ind, (X_b, y_b, w_b, ids_b) in enumerate(
              dataset.iterbatches(batch_size, pad_batches=pad_batches)):
              dataset.iterbatches(batch_size, pad_batches=True)): # hardcode pad_batches=True to work around limitations in Tensorflow
            if ind % log_every_N_batches == 0:
              log("On batch %d" % ind, self.verbosity)
            # Run training op.
@@ -701,11 +701,25 @@ class TensorflowModel(Model):
    """
    self.model_instance.fit(dataset, **kwargs)

  def predict(self, dataset, transformers=[], batch_size=None,
              pad_batches=False):
    """
    Uses self to make predictions on provided Dataset object.

    This is overridden to make sure the batch size is always valid for Tensorflow.

    Returns:
      y_pred: numpy ndarray of shape (n_samples,)
    """
    return Model.predict(self, dataset, transformers, self.model_instance.batch_size, True)

  def predict_on_batch(self, X):
    """
    Makes predictions on batch of data.
    """
    return self.model_instance.predict_on_batch(X)
    len_unpadded = len(X)
    Xpad = pad_features(self.model_instance.batch_size, X)
    return self.model_instance.predict_on_batch(Xpad)[:len_unpadded]

  def predict_grad_on_batch(self, X):
    """