Commit b567fa17 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Cleanup

parent a36e7917
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ install:
- conda install -c omnia openbabel
- conda install joblib
- conda install h5py
#- pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
- pip install keras 
- export KERAS_BACKEND=tensorflow
- conda install seaborn
+0 −4
Original line number Diff line number Diff line
@@ -30,10 +30,8 @@ from deepchem.models.keras_models.fcnet import MultiTaskDNN
from deepchem.models.tensorflow_models import TensorflowModel
from deepchem.models.tensorflow_models.fcnet import TensorflowMultiTaskClassifier
from deepchem.splits import ScaffoldSplitter
############################################################# DEBUG
import tensorflow as tf
from keras import backend as K
############################################################# DEBUG

def rf_model_builder(tasks, task_types, params_dict, model_dir, verbosity=None):
    """Builds random forests given hyperparameters.
@@ -179,12 +177,10 @@ class TestHyperparamOptAPI(TestAPI):
      
    def model_builder(tasks, task_types, model_params, task_model_dir,
                      verbosity=None):
      ############################################################# DEBUG
      g = tf.Graph()
      sess = tf.Session(graph=g)
      K.set_session(sess)
      with g.as_default():
      ############################################################# DEBUG
        return MultiTaskDNN(tasks, task_types, model_params, task_model_dir,
                            model_instance=LogisticRegression())
    optimizer = HyperparamOpt(MultiTaskDNN, tasks, task_types,
+0 −4
Original line number Diff line number Diff line
@@ -33,11 +33,9 @@ from deepchem.models.tensorflow_models import TensorflowModel
from deepchem.models.tensorflow_models.fcnet import TensorflowMultiTaskClassifier
from deepchem.splits import ScaffoldSplitter
from deepchem.splits import SpecifiedSplitter
############################################################# DEBUG
from deepchem.models.keras_models.fcnet import MultiTaskDNN
import tensorflow as tf
from keras import backend as K
############################################################# DEBUG

class TestModelAPI(TestAPI):
  """
@@ -297,12 +295,10 @@ class TestModelAPI(TestAPI):

  def test_multitask_keras_mlp_ECFP_classification_API(self):
    """Straightforward test of Keras multitask deepchem classification API."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      task_type = "classification"
      # TODO(rbharath): There should be some automatic check to ensure that all
      # required model_params are specified.
+0 −20
Original line number Diff line number Diff line
@@ -26,10 +26,8 @@ from deepchem.models.tensorflow_models import TensorflowModel
from deepchem.models.tensorflow_models.fcnet import TensorflowMultiTaskRegressor
from deepchem.models.tensorflow_models.fcnet import TensorflowMultiTaskClassifier
from deepchem.models.multitask import SingletaskToMultitask
############################################################# DEBUG
import tensorflow as tf
from keras import backend as K
############################################################# DEBUG

class TestOverfitAPI(TestAPI):
  """
@@ -156,12 +154,10 @@ class TestOverfitAPI(TestAPI):

  def test_keras_regression_overfit(self):
    """Test that keras models can overfit simple regression datasets."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      tasks = ["task0"]
      task_types = {task: "regression" for task in tasks}
      n_samples = 10
@@ -262,12 +258,10 @@ class TestOverfitAPI(TestAPI):

  def test_keras_classification_overfit(self):
    """Test that keras models can overfit simple classification datasets."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      tasks = ["task0"]
      task_types = {task: "classification" for task in tasks}
      n_samples = 10
@@ -317,12 +311,10 @@ class TestOverfitAPI(TestAPI):

  def test_keras_skewed_classification_overfit(self):
    """Test keras models can overfit 0/1 datasets with few actives."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      tasks = ["task0"]
      task_types = {task: "classification" for task in tasks}
      n_samples = 100
@@ -502,20 +494,12 @@ class TestOverfitAPI(TestAPI):
    X = np.random.rand(n_samples, n_features)
    y = np.random.binomial(1, p, size=(n_samples, n_tasks))
    w = np.ones((n_samples, n_tasks))
    print("np.count_nonzero(y)")
    print(np.count_nonzero(y))
    ##### DEBUG
    y_flat, w_flat = np.squeeze(y), np.squeeze(w)
    y_nonzero = y_flat[w_flat != 0]
    num_nonzero = np.count_nonzero(y_nonzero)
    weight_nonzero = len(y_nonzero)/num_nonzero
    print("weight_nonzero")
    print(weight_nonzero)
    w_flat[y_flat != 0] = weight_nonzero
    w = np.reshape(w_flat, (n_samples, n_tasks))
    print("np.amin(w), np.amax(w)")
    print(np.amin(w), np.amax(w))
    ##### DEBUG
  
    dataset = Dataset.from_numpy(self.train_dir, X, y, w, ids, tasks)

@@ -599,12 +583,10 @@ class TestOverfitAPI(TestAPI):

  def test_keras_multitask_classification_overfit(self):
    """Test keras multitask overfits tiny data."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      n_tasks = 10
      tasks = ["task%d" % task for task in range(n_tasks)]
      task_types = {task: "classification" for task in tasks}
@@ -751,12 +733,10 @@ class TestOverfitAPI(TestAPI):

  def test_keras_multitask_regression_overfit(self):
    """Test keras multitask overfits tiny data."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      n_tasks = 10
      tasks = ["task%d" % task for task in range(n_tasks)]
      task_types = {task: "regression" for task in tasks}
+0 −4
Original line number Diff line number Diff line
@@ -20,10 +20,8 @@ from deepchem.models.sklearn_models import SklearnModel
from deepchem.models.keras_models.fcnet import MultiTaskDNN
from deepchem.models.tensorflow_models import TensorflowModel
from deepchem.models.tensorflow_models.fcnet import TensorflowMultiTaskClassifier
############################################################# DEBUG
import tensorflow as tf
from keras import backend as K
############################################################# DEBUG

class TestModelReload(TestAPI):

@@ -73,12 +71,10 @@ class TestModelReload(TestAPI):

  def test_keras_reload(self):
    """Test that trained keras models can be reloaded correctly."""
    ############################################################# DEBUG
    g = tf.Graph()
    sess = tf.Session(graph=g)
    K.set_session(sess)
    with g.as_default():
    ############################################################# DEBUG
      tasks = ["task0"]
      task_types = {task: "classification" for task in tasks}
      n_samples = 10