Commit d5875180 authored by Bharath Ramsundar's avatar Bharath Ramsundar Committed by GitHub
Browse files

Merge pull request #753 from rbharath/deprecation

Deprecating all non-TensorGraph TF models
parents 300a60d6 7a77b821
Loading
Loading
Loading
Loading
+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,
+6 −0
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
+8 −0
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 time
import numpy as np
import tensorflow as tf
@@ -388,6 +389,8 @@ class TensorflowMultiTaskClassifier(TensorflowClassifier):
      mol_features: Molecule descriptor (e.g. fingerprint) tensor with shape
        batch_size x n_features.
    """
    warnings.warn("TensorflowMultiTaskClassifier is deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)
    placeholder_scope = TensorflowGraph.get_placeholder_scope(
        graph, name_scopes)
    n_features = self.n_features
@@ -485,6 +488,8 @@ class TensorflowMultiTaskRegressor(TensorflowRegressor):
      mol_features: Molecule descriptor (e.g. fingerprint) tensor with shape
        batch_size x n_features.
    """
    warnings.warn("TensorflowMultiTaskRegressor is deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)
    n_features = self.n_features
    placeholder_scope = TensorflowGraph.get_placeholder_scope(
        graph, name_scopes)
@@ -662,6 +667,9 @@ class TensorflowMultiTaskFitTransformRegressor(TensorflowMultiTaskRegressor):
      If not none, is used as random seed for tensorflow.

    """
    warnings.warn("TensorflowMultiTaskFitTransformRegressor "
                  "is deprecated. "
                  "Will be removed in DeepChem 1.4.", DeprecationWarning)

    self.fit_transformers = fit_transformers
    self.n_evals = n_evals
Loading