c6c9993a19ca6521871e3be00004891d47254972,examples/tox21/tox21_graph_conv.py,,,#,15

Before Change


// Only for debug!
np.random.seed(123)

g = tf.Graph()
sess = tf.Session(graph=g)
K.set_session(sess)

with g.as_default():
  // Load Tox21 dataset
  n_features = 1024
  tox21_tasks, tox21_datasets, transformers = load_tox21(featurizer="GraphConv")
  train_dataset, valid_dataset, test_dataset = tox21_datasets

  // Fit models
  metric = dc.metrics.Metric(
      dc.metrics.roc_auc_score, np.mean, mode="classification")

  // Do setup required for tf/keras models
  // Number of features on conv-mols
  n_feat = 75
  // Batch size of models
  batch_size = 50
  graph_model = dc.nn.SequentialGraph(n_feat)
  graph_model.add(dc.nn.GraphConv(64, activation="relu"))
  graph_model.add(dc.nn.BatchNormalization(epsilon=1e-5, mode=1))
  graph_model.add(dc.nn.GraphPool())
  graph_model.add(dc.nn.GraphConv(64, activation="relu"))
  graph_model.add(dc.nn.BatchNormalization(epsilon=1e-5, mode=1))
  graph_model.add(dc.nn.GraphPool())
  // Gather Projection
  graph_model.add(dc.nn.Dense(128, activation="relu"))
  graph_model.add(dc.nn.BatchNormalization(epsilon=1e-5, mode=1))
  graph_model.add(dc.nn.GraphGather(batch_size, activation="tanh"))
  // Dense post-processing layer

  with tf.Session() as sess:
    model = dc.models.MultitaskGraphClassifier(
      sess, graph_model, len(tox21_tasks), batch_size=batch_size,
      learning_rate=1e-3, learning_rate_decay_time=1000,
      optimizer_type="adam", beta1=.9, beta2=.999)

    // Fit trained model
    model.fit(train_dataset, nb_epoch=10)

    print("Evaluating model")
    train_scores = model.evaluate(train_dataset, [metric], transformers)
    valid_scores = model.evaluate(valid_dataset, [metric], transformers)

    print("Train scores")
    print(train_scores)

    print("Validation scores")
    print(valid_scores)

After Change


train_dataset, valid_dataset, test_dataset = tox21_datasets

// Fit models
metric = dc.metrics.Metric(
    dc.metrics.roc_auc_score, np.mean, mode="classification")

// Do setup required for tf/keras models
// Number of features on conv-mols
n_feat = 75
// Batch size of models
batch_size = 50
graph_model = dc.nn.SequentialGraph(n_feat)
graph_model.add(dc.nn.GraphConv(64, n_feat, activation="relu"))
graph_model.add(dc.nn.BatchNormalization(epsilon=1e-5, mode=1))
graph_model.add(dc.nn.GraphPool())
graph_model.add(dc.nn.GraphConv(64, 64, activation="relu"))
graph_model.add(dc.nn.BatchNormalization(epsilon=1e-5, mode=1))
graph_model.add(dc.nn.GraphPool())
// Gather Projection
graph_model.add(dc.nn.Dense(128, 64, activation="relu"))
graph_model.add(dc.nn.BatchNormalization(epsilon=1e-5, mode=1))
graph_model.add(dc.nn.GraphGather(batch_size, activation="tanh"))

model = dc.models.MultitaskGraphClassifier(
  graph_model,
  len(tox21_tasks),
  n_feat,
  batch_size=batch_size,
  learning_rate=1e-3,
  learning_rate_decay_time=1000,
  optimizer_type="adam",
  beta1=.9,
  beta2=.999)

// Fit trained model
model.fit(train_dataset, nb_epoch=10)

print("Evaluating model")
train_scores = model.evaluate(train_dataset, [metric], transformers)
valid_scores = model.evaluate(valid_dataset, [metric], transformers)

print("Train scores")
print(train_scores)

print("Validation scores")
print(valid_scores)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 41

Instances


Project Name: deepchem/deepchem
Commit Name: c6c9993a19ca6521871e3be00004891d47254972
Time: 2017-02-23
Author: bharath.ramsundar@gmail.com
File Name: examples/tox21/tox21_graph_conv.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: c6c9993a19ca6521871e3be00004891d47254972
Time: 2017-02-23
Author: bharath.ramsundar@gmail.com
File Name: examples/sampl/sampl_graph_conv.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: c6c9993a19ca6521871e3be00004891d47254972
Time: 2017-02-23
Author: bharath.ramsundar@gmail.com
File Name: examples/clintox/clintox_graph_conv.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: c6c9993a19ca6521871e3be00004891d47254972
Time: 2017-02-23
Author: bharath.ramsundar@gmail.com
File Name: examples/chembl/chembl_graph_conv.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: c6c9993a19ca6521871e3be00004891d47254972
Time: 2017-02-23
Author: bharath.ramsundar@gmail.com
File Name: examples/tox21/tox21_graph_conv.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: c6c9993a19ca6521871e3be00004891d47254972
Time: 2017-02-23
Author: bharath.ramsundar@gmail.com
File Name: examples/delaney/delaney_graph_conv.py
Class Name:
Method Name: