Example #1
0
from __future__ import unicode_literals

import os
import numpy as np
import tempfile
import shutil
import deepchem as dc
from sklearn.ensemble import RandomForestRegressor
from MERCK_datasets import load_uv

###Load data###
shard_size = 2000
num_cores = 1
num_shards_per_batch = 4
print("About to load UV data.")
UV_tasks, datasets, transformers = load_uv(
    shard_size=shard_size, num_shards_per_batch=num_shards_per_batch)
train_dataset, valid_dataset, test_dataset = datasets

print("Number of compounds in train set")
print(len(train_dataset))
print("Number of compounds in validation set")
print(len(valid_dataset))
print("Number of compounds in test set")
print(len(test_dataset))

num_features = train_dataset.get_data_shape()[0]
print("Num features: %d" % num_features)


def task_model_builder(model_dir):
    sklearn_model = RandomForestRegressor(n_estimators=100,
Example #2
0
import os
import tempfile
import shutil
import numpy as np
import deepchem as dc
from MERCK_datasets import load_uv

# Set numpy seed
np.random.seed(123)

###Load data###
shard_size = 2000
num_shards_per_batch = 4
print("About to load MERCK data.")
UV_tasks, datasets, transformers = load_uv(
    shard_size=shard_size, num_shards_per_batch=num_shards_per_batch)
train_dataset, valid_dataset, test_dataset = datasets

print("Number of compounds in train set")
print(len(train_dataset))
print("Number of compounds in validation set")
print(len(valid_dataset))
print("Number of compounds in test set")
print(len(test_dataset))

###Create model###
n_layers = 3
nb_epoch = 50
model = dc.models.ProgressiveMultitaskRegressor(
    len(UV_tasks),
    train_dataset.get_data_shape()[0],