Commit 588901e2 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Cruft cleanup

parent 65f7a6fb
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -211,13 +211,6 @@ class Dataset(object):
    if tasks is None:
      tasks = np.arange(n_tasks)
    raw_data = (ids, X, y, w)
    ###################  DEBUG
    #print("Dataset.from_numpy()")
    #print("type(y)")
    #print(type(y))
    #print("type(X)")
    #print(type(X))
    ###################  DEBUG
    return Dataset(data_dir=data_dir, tasks=tasks, raw_data=raw_data)
    
  def to_numpy(self):
@@ -338,13 +331,6 @@ def write_dataset_single(val, data_dir, feature_types=None, tasks=None,
    ids, X, y, w = _df_to_numpy(df, feature_types, tasks)
  else:
    ids, X, y, w = raw_data
    ###################  DEBUG
    #print("write_dataset_single()")
    #print("type(y)")
    #print(type(y))
    #print("type(X)")
    #print(type(X))
    ###################  DEBUG
    df_file = ""
    assert X.shape[0] == y.shape[0]
    assert y.shape == w.shape
@@ -399,22 +385,6 @@ def _df_to_numpy(df, feature_types, tasks):
  n_samples = df.shape[0]
  n_tasks = len(tasks)
  y = np.hstack([np.reshape(np.array(df[task].values), (n_samples, 1)) for task in tasks])
  ############ DEBUG
  #print("Dataset._df_to_numpy()")
  #print("tasks")
  #print(tasks)
  #print("y.shape")
  #print(y.shape)
  #print("Before reshape")
  #print("y")
  #print(y)
  ########### DEBUG
  #y = np.reshape(y, (n_samples, n_tasks))
  ############ DEBUG
  #print("After reshape")
  #print("y")
  #print(y)
  ############ DEBUG
  w = np.ones((n_samples, n_tasks))
  missing = np.zeros_like(y).astype(int)
  tensors = []
+0 −4
Original line number Diff line number Diff line
@@ -113,18 +113,14 @@ class TestLoad(TestAPI):

    ################## Do comparison
    for ind, task in enumerate(tasks):
      #X_multi_task = X_multi[ind]
      y_multi_task = y_multi[:, ind]
      w_multi_task = w_multi[:, ind]
      #ids_multi_task = ids_multi[ind]

      #X_task = X_tasks[ind]
      y_task = y_tasks[ind]
      w_task = w_tasks[ind]
      ids_task = ids_tasks[ind]

      #np.testing.assert_allclose(X_multi_task, X_task)
      np.testing.assert_allclose(y_multi_task.flatten(), y_task.flatten())
      np.testing.assert_allclose(w_multi_task.flatten(), w_task.flatten())
      #np.testing.assert_allclose(ids_multi_task, ids_task)
    shutil.rmtree(base_dir)
+0 −10
Original line number Diff line number Diff line
@@ -155,11 +155,6 @@ class Model(object):
    n_samples, n_tasks = len(dataset), len(self.tasks)
    y_pred = y_pred[:n_samples]
    y_pred = np.reshape(y_pred, (n_samples, n_tasks))
    ############## DEBUG
    #print("Model.predict()")
    #print("y_pred.shape")
    #print(y_pred.shape)
    ############## DEBUG
    return y_pred

  def predict_proba(self, dataset, transformers=[], n_classes=2):
@@ -174,11 +169,6 @@ class Model(object):
    n_tasks = len(self.tasks)
    for (X_batch, y_batch, w_batch, ids_batch) in dataset.iterbatches(batch_size):
      y_pred_batch = self.predict_proba_on_batch(X_batch)
      ########################## DEBUG
      #print("Model.predict_proba()")
      #print("y_pred_batch.shape")
      #print(y_pred_batch.shape)
      ########################## DEBUG
      batch_size = len(y_batch)
      y_pred_batch = np.squeeze(
          np.reshape(y_pred_batch, (batch_size, n_tasks, n_classes)))
+0 −5
Original line number Diff line number Diff line
@@ -42,11 +42,6 @@ class SklearnModel(Model):
    Fits SKLearn model to data.
    """
    X, y, w, _ = dataset.to_numpy()
    ###################### DEBUG
    #print("SklearnModel.fit()")
    #print("X.shape, y.shape, w.shape")
    #print(X.shape, y.shape, w.shape)
    ###################### DEBUG
    y, w = np.squeeze(y), np.squeeze(w)
    # Logistic regression doesn't support weights
    if not isinstance(self.raw_model, LogisticRegression):