Commit 6c30d262 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Cleanup

parent 9d385e0f
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -875,18 +875,11 @@ class DiskDataset(Dataset):
  def X(self):
    """Get the X vector for this dataset as a single numpy array."""
    Xs = []
    ##################################################### DEBUG
    #print("dataset.X computation.")
    one_dimensional = False
    ##################################################### DEBUG
    for (X_b, _, _, _) in self.itershards():
      Xs.append(X_b)
      ##################################################### DEBUG
      #print("X_b.shape")
      #print(X_b.shape)
      if len(X_b.shape) == 1:
        one_dimensional = True
      ##################################################### DEBUG
    if not one_dimensional:
      return np.vstack(Xs)
    else:
+0 −16
Original line number Diff line number Diff line
@@ -158,11 +158,9 @@ class Model(object):
    for (X_batch, y_batch, w_batch, ids_batch) in dataset.iterbatches(
        batch_size, deterministic=True):
      n_samples = len(X_batch)
      ########################################################## DEBUG
      y_pred_batch = self.predict_on_batch(X_batch, pad_batch=pad_batches)
      # Discard any padded predictions
      y_pred_batch = y_pred_batch[:n_samples]
      ########################################################## DEBUG
      y_pred_batch = np.reshape(y_pred_batch, (n_samples, n_tasks))
      y_pred_batch = undo_transforms(y_pred_batch, transformers)
      y_preds.append(y_pred_batch)
@@ -171,10 +169,6 @@ class Model(object):
    # The iterbatches does padding with zero-weight examples on the last batch.
    # Remove padded examples.
    n_samples = len(dataset)
    ################################################### DEBUG
    print("n_samples, y_pred.shape, (n_samples, n_tasks)")
    print(n_samples, y_pred.shape, (n_samples, n_tasks))
    ################################################### DEBUG
    y_pred = np.reshape(y_pred, (n_samples, n_tasks))
    # Special case to handle singletasks.
    if n_tasks == 1:
@@ -375,17 +369,7 @@ class Model(object):
        batch_size, deterministic=True):
      n_samples = len(X_batch)
      y_pred_batch = self.predict_proba_on_batch(X_batch, pad_batch=pad_batches)
      ################################################################# DEBUG
      print("X_batch.shape")
      print(X_batch.shape)
      print("y_pred_batch.shape")
      print(y_pred_batch.shape)
      ################################################################# DEBUG
      y_pred_batch = y_pred_batch[:n_samples]
      ################################################################# DEBUG
      print("y_pred_batch.shape, (n_samples, n_tasks, n_classes)")
      print(y_pred_batch.shape, (n_samples, n_tasks, n_classes))
      ################################################################# DEBUG
      y_pred_batch = np.reshape(y_pred_batch, (n_samples, n_tasks, n_classes))
      y_pred_batch = undo_transforms(y_pred_batch, transformers)
      y_preds.append(y_pred_batch)
+0 −7
Original line number Diff line number Diff line
@@ -556,13 +556,6 @@ class TensorflowClassifier(TensorflowGraphModel):
              'Unrecognized rank combination for output: %s ' %
              (batch_outputs.shape,))

      # TODO(rbharath): This is a bug! We're actually applying softmax twice.
      # I believe this is harmless since softmax of softmax doesn't change
      # properties, but I need to check this...
      # We apply softmax to predictions to get class probabilities.
      #outputs = softmax(np.squeeze(batch_outputs))
      #outputs = softmax(batch_outputs)

      # Note that softmax is already applied in construct_grpah
      outputs = batch_outputs