1b97292ef55358a0207ea3fb04f9d26b8266122d,examples/low_data/tox_graph_conv_one_fold.py,,,#,15
Before Change
for trial_num, (task, support) in enumerate(support_generator):
print("Starting trial %d" % trial_num)
// Train model on support
g = tf.Graph()
sess = tf.Session(graph=g)
// Do setup required for tf/keras models
// Number of features on conv-mols
n_feat = 75
// Batch size of models
batch_size = 50
with g.as_default():
graph_model = dc.nn.SequentialGraph(n_feat)
graph_model.add(dc.nn.GraphConv(64, activation="relu"))
graph_model.add(dc.nn.GraphPool())
graph_model.add(dc.nn.GraphConv(128, activation="relu"))
graph_model.add(dc.nn.GraphPool())
graph_model.add(dc.nn.GraphConv(64, activation="relu"))
graph_model.add(dc.nn.GraphPool())
graph_model.add(dc.nn.Dense(128, activation="tanh"))
graph_model.add(dc.nn.GraphGather(batch_size, activation="tanh"))
with tf.Session() as sess:
model = dc.models.MultitaskGraphClassifier(
sess, graph_model, 1, 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(support, nb_epoch=10)
// Test model
task_dataset = dc.data.get_task_dataset_minus_support(
test_dataset, support, task)
y_pred = model.predict_proba(task_dataset)
score = metric.compute_metric(
task_dataset.y, y_pred, task_dataset.w)
print("Score on task %s is %s" % (str(task), str(score)))
task_scores[task].append(score)
// Join information for all tasks.
mean_task_scores = {}
std_task_scores = {}
for task in range(len(test_dataset.get_task_names())):
mean_task_scores[task] = np.mean(np.array(task_scores[task]))
After Change
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
from datasets import load_tox21_convmol
// 4-fold splits
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances Project Name: deepchem/deepchem
Commit Name: 1b97292ef55358a0207ea3fb04f9d26b8266122d
Time: 2017-03-04
Author: bharath.ramsundar@gmail.com
File Name: examples/low_data/tox_graph_conv_one_fold.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/tox21/tox21_graph_conv.py
Class Name:
Method Name: