a1a2b8475e0a1bde9eec14125b15829228aa55e9,examples/muv/muv_keras.py,,,#,20

Before Change


// Set some global variables up top
np.random.seed(123)
reload = True
verbosity = "high"

base_dir = "/tmp/muv_keras"
model_dir = os.path.join(base_dir, "model")
if os.path.exists(base_dir):
  shutil.rmtree(base_dir)
os.makedirs(base_dir)

// Load MUV data
muv_tasks, muv_datasets, transformers = load_muv(
    base_dir, reload=reload)
train_dataset, valid_dataset = muv_datasets 
n_features = 1024 


// Build model
classification_metric = Metric(metrics.roc_auc_score, np.mean,
                               verbosity=verbosity,
                               mode="classification")

keras_model = MultiTaskDNN(len(muv_tasks), n_features, "classification",
                           dropout=.25, learning_rate=.001, decay=1e-4)
model = KerasModel(keras_model, self.model_dir, verbosity=verbosity)

// Fit trained model
model.fit(train_dataset)
model.save()

train_evaluator = Evaluator(model, train_dataset, transformers, verbosity=verbosity)
train_scores = train_evaluator.compute_model_performance([classification_metric])

print("Train scores")
print(train_scores)

valid_evaluator = Evaluator(model, valid_dataset, transformers, verbosity=verbosity)
valid_scores = valid_evaluator.compute_model_performance([classification_metric])

print("Validation scores")
print(valid_scores)

After Change


keras_model = dc.models.MultiTaskDNN(
    len(muv_tasks), n_features, "classification",
    dropout=.25, learning_rate=.001, decay=1e-4)
model = dc.models.KerasModel(keras_model, verbosity="high")

// Fit trained model
model.fit(train_dataset)
model.save()

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

print("Train scores")
print(train_scores)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: deepchem/deepchem
Commit Name: a1a2b8475e0a1bde9eec14125b15829228aa55e9
Time: 2016-11-03
Author: bharath.ramsundar@gmail.com
File Name: examples/muv/muv_keras.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: 1a0a14ac9ca854a013083c7430221167283329e7
Time: 2016-11-02
Author: bharath.ramsundar@gmail.com
File Name: examples/tox21/tox21_tf_models.py
Class Name:
Method Name:


Project Name: deepchem/deepchem
Commit Name: 1a0a14ac9ca854a013083c7430221167283329e7
Time: 2016-11-02
Author: bharath.ramsundar@gmail.com
File Name: examples/muv/muv_tf.py
Class Name:
Method Name: