示例#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 UV_datasets import load_uv

###Load data###
np.random.seed(123)
shard_size = 2000
num_trials = 5
print("About to load UV data.")
UV_tasks, datasets, transformers = load_uv(shard_size=shard_size)
train_dataset, valid_dataset, test_dataset = datasets
####################################################### DEBUG
print("np.amin(train_dataset.y)")
print(np.amin(train_dataset.y))
print("np.amax(train_dataset.y)")
print(np.amax(train_dataset.y))
####################################################### DEBUG

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))
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

import os
import tempfile
import shutil
import numpy as np
import deepchem as dc
from UV_datasets import load_uv

###Load data###
shard_size = 2000
num_trials = 2
print("About to load UV data.")
UV_tasks, datasets, transformers = load_uv(shard_size=shard_size)
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))

all_results = []
for trial in range(num_trials):
  ###Create model###
  n_layers = 3
  nb_epoch = 50
  model = dc.models.TensorflowMultiTaskRegressor(