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

Singletask numbers on MUV are now functional.

parent 5c35018f
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -150,18 +150,24 @@ class Model(object):
    print(X.shape, y.shape, w.shape, ids.shape)
    
    #X = X[w.flatten() != 0, :]
    num_tasks = y.shape[1]

    y_pred = self.predict_on_batch(X)

    y = y[w.flatten() != 0, :]
    y = to_one_hot(y)
    y_pred_d = y_pred[w.flatten() != 0, :]

    print("X.shape, y.shape, y_pred_d.shape")
    print(X.shape, y.shape, y_pred_d.shape)
    print("Model.predict()")
    print("sklearn.metrics.roc_auc_score(y, y_pred_d)")
    print(sklearn.metrics.roc_auc_score(y, y_pred_d))
    for task in xrange(num_tasks):
      y_task, w_task, y_pred_task = y[:, task], w[:, task], y_pred[:, task]
      y_task = y_task[w_task.flatten() != 0]
      y_task = to_one_hot(y_task)
      y_pred_task = y_pred_task[w_task.flatten() != 0][:, np.newaxis]
      #y_pred_d = y_pred[w_task.flatten() != 0][:, np.newaxis]

      print("task %d" % task)
      print("sklearn.metrics.roc_auc_score(y_task, y_pred_d)")
      
      print("y_task.shape, w_task.shape, y_pred_task.shape")
      print(y_task.shape, w_task.shape, y_pred_task.shape)
      print(sklearn.metrics.roc_auc_score(y_task, y_pred_task))

    return y_pred

+4 −4
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ verbosity = "high"

# Create some directories for analysis
# The base_dir holds the results of all analysis
#base_dir = "/scratch/users/rbharath/muv_multitask_analysis"
base_dir = "/scratch/users/rbharath/small_muv_multitask_analysis"
base_dir = "/scratch/users/rbharath/muv_multitask_analysis"
#base_dir = "/scratch/users/rbharath/small_muv_multitask_analysis"
current_dir = os.path.dirname(os.path.realpath(__file__))
#Make directories to store the raw and featurized datasets.
feature_dir = os.path.join(base_dir, "features")
@@ -59,8 +59,8 @@ MUV_tasks = sorted(['MUV-692', 'MUV-689', 'MUV-846', 'MUV-859', 'MUV-644',
                    'MUV-737', 'MUV-858', 'MUV-713', 'MUV-733', 'MUV-652',
                    'MUV-466', 'MUV-832'])
# For debugging purposes
MUV_tasks = MUV_tasks[0:1]
print("Only using following tasks")
#MUV_tasks = MUV_tasks[0:1]
print("Using following tasks")
print(MUV_tasks)
featurizer = DataFeaturizer(tasks=MUV_tasks,
                            smiles_field="smiles",