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

Merge pull request #360 from rbharath/low_data_updates

Updates to Low Data Models
parents 778e9e5e ce3478b9
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ class TestOverfit(test_util.TensorFlowTestCase):
        # can measure model has memorized support).  Replacement is turned off to
        # ensure that support contains full training set. This checks that the
        # model has mastered memorization of provided support.
        scores = model.evaluate(dataset, classification_metric, n_trials=5,
        scores, _ = model.evaluate(dataset, classification_metric, n_trials=5,
                                   n_pos=n_pos, n_neg=n_neg,
                                   exclude_support=False)

@@ -686,7 +686,7 @@ class TestOverfit(test_util.TensorFlowTestCase):
        # can measure model has memorized support).  Replacement is turned off to
        # ensure that support contains full training set. This checks that the
        # model has mastered memorization of provided support.
        scores = model.evaluate(dataset, classification_metric, n_trials=5,
        scores, _ = model.evaluate(dataset, classification_metric, n_trials=5,
                                   n_pos=n_pos, n_neg=n_neg,
                                   exclude_support=False)

@@ -754,7 +754,7 @@ class TestOverfit(test_util.TensorFlowTestCase):
        # can measure model has memorized support).  Replacement is turned off to
        # ensure that support contains full training set. This checks that the
        # model has mastered memorization of provided support.
        scores = model.evaluate(dataset, classification_metric, n_trials=5,
        scores, _ = model.evaluate(dataset, classification_metric, n_trials=5,
                                   n_pos=n_pos, n_neg=n_neg,
                                   exclude_support=False)

+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ class MultitaskGraphClassifier(Model):
    self.add_optimizer()

    # Initialize
    self.init_fn = tf.initialize_all_variables()
    self.init_fn = tf.global_variables_initializer()
    sess.run(self.init_fn)  

    # Path to save checkpoint files, which matches the
+3 −1
Original line number Diff line number Diff line
@@ -413,6 +413,8 @@ class SupportGraphClassifier(Model):

    # Join information for all tasks.
    mean_task_scores = {}
    std_task_scores = {}
    for task in test_tasks:
      mean_task_scores[task] = np.mean(np.array(task_scores[task]))
    return mean_task_scores
      std_task_scores[task] = np.std(np.array(task_scores[task]))
    return mean_task_scores, std_task_scores
+6 −6
Original line number Diff line number Diff line
@@ -640,7 +640,7 @@ def add_bias(tensor, init=None, name=None):
  """
  if init is None:
    init = tf.zeros([tensor.get_shape()[-1].value])
  with tf.op_scope([tensor], name, tensor.op.name):
  with tf.name_scope(name, tensor.op.name, [tensor]):
    b = tf.Variable(init, name='b')
    return tf.nn.bias_add(tensor, b)

@@ -718,7 +718,7 @@ def fully_connected_layer(tensor, size=None, weight_init=None, bias_init=None,
  if bias_init is None:
    bias_init = tf.zeros([size])

  with tf.op_scope([tensor], name, 'fully_connected'):
  with tf.name_scope(name, 'fully_connected', [tensor]):
    w = tf.Variable(weight_init, name='w', dtype=tf.float32)
    b = tf.Variable(bias_init, name='b', dtype=tf.float32)
    return tf.nn.xw_plus_b(tensor, w, b)
@@ -773,8 +773,8 @@ def multitask_logits(features, num_tasks, num_classes=2, weight_init=None,
  logits_list = []
  with tf.name_scope('multitask_logits'):
    for task_idx in range(num_tasks):
      with tf.op_scope([features], name,
                       ('task' + str(task_idx).zfill(len(str(num_tasks))))):
      with tf.name_scope(name, ('task' + str(task_idx).zfill(len(str(num_tasks)))),
                       [features]):
        logits_list.append(
            logits(features, num_classes, weight_init=weight_init,
                   bias_init=bias_init, dropout_prob=dropout_prob))
@@ -800,7 +800,7 @@ def logits(features, num_classes=2, weight_init=None, bias_init=None,
  Returns:
    A logits tensor with shape batch_size x num_classes.
  """
  with tf.op_scope([features], name, 'logits') as name:
  with tf.name_scope(name, 'logits', [features]) as name:
    return dropout(
        fully_connected_layer(features, num_classes, weight_init=weight_init,
                              bias_init=bias_init, name=name),
@@ -817,7 +817,7 @@ def softmax_N(tensor, name=None):
  Returns:
    A tensor with softmax-normalized values on the last dimension.
  """
  with tf.op_scope([tensor], name, 'softmax_N'):
  with tf.name_scope(name, 'softmax_N', [tensor]):
    exp_tensor = tf.exp(tensor)
    reduction_indices = [tensor.get_shape().ndims - 1]
    return tf.div(exp_tensor,
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ def load_sider_convmol():

  loader = dc.data.CSVLoader(
      tasks=SIDER_tasks, smiles_field="smiles", featurizer=featurizer)
  dataset = loader.featurize(dataset_file, debug=True)
  dataset = loader.featurize(dataset_file)
  print("%d datapoints in SIDER dataset" % len(dataset))

  # Initialize transformers
Loading