Hyperparameter Tuning GraphConvModel Issue

I’ve trying to run hyperparameter tuning for a GraphConvModel, but it keeps spitting out an error about the metric not being iterable. Any help is deeply appreciated!

This is the code:

metric = dc.metrics.Metric(dc.metrics.pearson_r2_score)
params_dict = {
“np_epoch”:[1,100],
“n_tasks”:[1],
“graph_conv_layers”:[[64, 64]],
“dense_layer_size”:[128,256,512],
“dropout”:[0.0],
“number_atom_features”:[75],
“batch_size”:[10,20],
}
optimizer = dc.hyper.GaussianProcessHyperparamOpt(lambda p: dc.models.GraphConvModel(n_tasks=1, mode=‘regression’, p))
best_model, best_hyperparams, all_results = optimizer.hyperparam_search(
params_dict,
train_dataset,
valid_dataset,
transformers,
metric)
printing out results
print("\n===================BEST MODEL=================")
print(best_model)
print("\n===================BEST Params=================")
print(best_hyperparams)
print("\n===================ALL_RESULTS=================")
print(all_results)

And this is the full error message:

TypeError Traceback (most recent call last)
in
17 valid_dataset,
18 transformers,
—> 19 metric)
20
21 #printing out results
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/deepchem/hyper/gaussian_process.py in hyperparam_search(self, params_dict, train_dataset, valid_dataset, metric, output_transformers, nb_epoch, use_max, logdir, max_iter, search_range, logfile, **kwargs)
343 gpgo = GPGO(gp, acq, optimizing_function, param_range)
344 logger.info(“Max number of iteration: %i” % max_iter)
–> 345 gpgo.run(max_iter=max_iter)
346
347 hp_opt, valid_performance_opt = gpgo.getResult()
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/pyGPGO/GPGO.py in run(self, max_iter, init_evals, resume)
186 if not resume:
187 self.init_evals = init_evals
–> 188 self._firstRun(self.init_evals)
189 self.logger._printInit(self)
190 for iteration in range(max_iter):
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/pyGPGO/GPGO.py in _firstRun(self, n_eval)
86 s_param_val = list(s_param.values())
87 self.X[i] = s_param_val
—> 88 self.y[i] = self.f(**s_param)
89 self.GP.fit(self.X, self.y)
90 self.tau = np.max(self.y)
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/deepchem/hyper/gaussian_process.py in optimizing_function(placeholders)
335 valid set performances
336 “”"
–> 337 return _optimize(nb_epoch=nb_epoch, placeholders)
338
339 # execute GPGO
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/deepchem/hyper/gaussian_process.py in _optimize(nb_epoch, **placeholders)
297
298 multitask_scores = model.evaluate(valid_dataset, [metric],
–> 299 output_transformers)
300 score = multitask_scores[metric.name]
301
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/deepchem/models/models.py in evaluate(self, dataset, metrics, transformers, per_task_metrics, use_sample_weights, n_classes)
213 separately.
214 “”"
–> 215 evaluator = Evaluator(self, dataset, transformers)
216 return evaluator.compute_model_performance(
217 metrics,
/hpc/group/rekerlab/pjs57/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/deepchem/utils/evaluate.py in init(self, model, dataset, transformers)
192 self.dataset = dataset
193 self.output_transformers = [
–> 194 transformer for transformer in transformers if transformer.transform_y
195 ]
196
TypeError: ‘Metric’ object is not iterable

I resolved this by switching the order of “metric” and “transformers”. However, a new error popped up about positive definiteness, a concept which I understand but have no coding grasp on. Again, any help is much appreciated!

/miniconda3/envs/MLnotebook/lib/python3.6/site-packages/scipy/linalg/decomp_cholesky.py in _cholesky(a, lower, overwrite_a, clean, check_finite)
36 if info > 0:
37 raise LinAlgError("%d-th leading minor of the array is not positive "
—> 38 “definite” % info)
39 if info < 0:
40 raise ValueError(‘LAPACK reported an illegal value in {}-th argument’

LinAlgError: 3-th leading minor of the array is not positive definite