Commit c83d7cb3 authored by leswing's avatar leswing
Browse files

Merge branch 'master' into k_fold

parents 0c74f94c 59a229a5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
[![Coverage Status](https://coveralls.io/repos/github/deepchem/deepchem/badge.svg?branch=master)](https://coveralls.io/github/deepchem/deepchem?branch=master)

DeepChem aims to provide a high quality open-source toolchain that
democratizes the use of deep-learning in drug discovery, materials science, and quantum chemistry.
democratizes the use of deep-learning in drug discovery, materials science, quantum chemistry, and biology.

### Table of contents:

+5 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
TODO(LESWING) Remove h5py dependency
TODO(LESWING) Remove keras dependency and replace with functional keras API
"""

import warnings
from deepchem.models import Model
from deepchem.models.autoencoder_models.model import MoleculeVAE
from deepchem.feat.one_hot import zinc_charset
@@ -38,6 +38,8 @@ class TensorflowMoleculeEncoder(Model):
    latent_rep_size: int
      How large a 1D Vector for latent representation
    """
    warnings.warn("TensorflowMoleculeEncoder Deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)
    super(TensorflowMoleculeEncoder, self).__init__(
        model_dir=model_dir, verbose=verbose)
    weights_file = os.path.join(model_dir, weights_file)
@@ -105,6 +107,8 @@ class TensorflowMoleculeDecoder(Model):
    latent_rep_size: int
      How large a 1D Vector for latent representation
    """
    warnings.warn("TensorflowMoleculeDecoder Deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)
    super(TensorflowMoleculeDecoder, self).__init__(
        model_dir=model_dir, verbose=verbose)
    weights_file = os.path.join(model_dir, weights_file)
+5 −0
Original line number Diff line number Diff line
import warnings
from keras import backend as K
from keras import objectives
from keras.layers import Input, Lambda
@@ -12,6 +13,10 @@ class MoleculeVAE():

  autoencoder = None

  def __init__(self):
    warnings.warn("Deprecated. Will be removed in DeepChem 1.4.",
                  DeprecationWarning)

  def create(self,
             charset_length,
             max_length=120,
+8 −5
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

import warnings
import time
import numpy as np
import tensorflow as tf
@@ -58,7 +59,9 @@ class TensorflowMultiTaskIRVClassifier(TensorflowLogisticRegression):
      If not none, is used as random seed for tensorflow.        

    """

    warnings.warn("The TensorflowMultiTaskIRVClassifier is "
                  "deprecated. Will be removed in DeepChem 1.4.",
                  DeprecationWarning)
    self.n_tasks = n_tasks
    self.K = K
    self.n_features = 2 * self.K * self.n_tasks
@@ -89,8 +92,8 @@ class TensorflowMultiTaskIRVClassifier(TensorflowLogisticRegression):
       
       https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2750043/
    """
    placeholder_scope = TensorflowGraph.get_placeholder_scope(graph,
                                                              name_scopes)
    placeholder_scope = TensorflowGraph.get_placeholder_scope(
        graph, name_scopes)
    K = self.K
    with graph.as_default():
      output = []
@@ -104,8 +107,8 @@ class TensorflowMultiTaskIRVClassifier(TensorflowLogisticRegression):
        b2 = tf.Variable(tf.constant([0.01]), name="b2", dtype=tf.float32)

      label_placeholders = self.add_label_placeholders(graph, name_scopes)
      weight_placeholders = self.add_example_weight_placeholders(graph,
                                                                 name_scopes)
      weight_placeholders = self.add_example_weight_placeholders(
          graph, name_scopes)
      if training:
        graph.queue = tf.FIFOQueue(
            capacity=5,
+16 −6
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

import warnings
import collections
import pickle
import os
@@ -50,6 +51,8 @@ class TensorflowGraph(object):

  def __init__(self, graph, session, name_scopes, output, labels, weights,
               loss):
    warnings.warn("TensorflowGraph is deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)
    self.graph = graph
    self.session = session
    self.name_scopes = name_scopes
@@ -175,6 +178,9 @@ class TensorflowGraphModel(Model):
    seed: int
      If not none, is used as random seed for tensorflow.
    """
    warnings.warn("TensorflowGraphModel is deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)

    # Save hyperparameters
    self.n_tasks = n_tasks
    self.n_features = n_features
@@ -438,8 +444,8 @@ class TensorflowGraphModel(Model):
    feeding and fetching the same tensor.
    """
    weights = []
    placeholder_scope = TensorflowGraph.get_placeholder_scope(graph,
                                                              name_scopes)
    placeholder_scope = TensorflowGraph.get_placeholder_scope(
        graph, name_scopes)
    with placeholder_scope:
      for task in range(self.n_tasks):
        weights.append(
@@ -482,11 +488,15 @@ class TensorflowGraphModel(Model):
    if train:
      if not self.train_graph.session:
        config = tf.ConfigProto(allow_soft_placement=True)
        #gpu memory growth option
        config.gpu_options.allow_growth = True
        self.train_graph.session = tf.Session(config=config)
      return self.train_graph.session
    else:
      if not self.eval_graph.session:
        config = tf.ConfigProto(allow_soft_placement=True)
        #gpu memory growth option
        config.gpu_options.allow_growth = True
        self.eval_graph.session = tf.Session(config=config)
      return self.eval_graph.session

@@ -639,8 +649,8 @@ class TensorflowClassifier(TensorflowGraphModel):
    Placeholders are wrapped in identity ops to avoid the error caused by
    feeding and fetching the same tensor.
    """
    placeholder_scope = TensorflowGraph.get_placeholder_scope(graph,
                                                              name_scopes)
    placeholder_scope = TensorflowGraph.get_placeholder_scope(
        graph, name_scopes)
    with graph.as_default():
      batch_size = self.batch_size
      n_classes = self.n_classes
@@ -792,8 +802,8 @@ class TensorflowRegressor(TensorflowGraphModel):
    Placeholders are wrapped in identity ops to avoid the error caused by
    feeding and fetching the same tensor.
    """
    placeholder_scope = TensorflowGraph.get_placeholder_scope(graph,
                                                              name_scopes)
    placeholder_scope = TensorflowGraph.get_placeholder_scope(
        graph, name_scopes)
    with graph.as_default():
      batch_size = self.batch_size
      labels = []
Loading