question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: mode must be either 'classification' or 'regression' in Hyper-parameter optimization

See original GitHub issue

Hi, thank you for sharing your great work.

I am trying hyper-parameter optimization:

import deepchem as dc

tasks, datasets, transformers = dc.molnet.load_delaney(featurizer='GraphConv')
train_dataset, valid_dataset, test_dataset = datasets

metric = dc.metrics.Metric(dc.metrics.r2_score)

params_dict = {
    'n_tasks': [len(tasks)],
    'mode': 'regression',
    'graph_conv_layers': [[64], [64, 64]],
    'dropouts': [0.2, 0.5]
}

optimizer = dc.hyper.GridHyperparamOpt(dc.models.GraphConvModel)

best_model, best_hyperparams, all_results = optimizer.hyperparam_search(
        params_dict, train_dataset, valid_dataset, metric, transformers)

However, I get the error:

ValueError: mode must be either 'classification' or 'regression'

Environment:

  • OS: macOS 11.5
  • Python 3.7
  • deepchem == 2.5.0
  • TensorFlow == 2.6.0
  • PyTorch == 1.7.0

Thank you for your help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rbharathcommented, Sep 8, 2021

Looking at the source, I’m able to confirm it does indeed return a tuple and not a dictionary:

https://github.com/deepchem/deepchem/blob/master/deepchem/hyper/grid_search.py#L172

We should correct this. It’s a little delicate since we don’t want to break backwards compatibility in anyone’s code that’s been assuming tuples instead of dictionaries. I suggest for now we just update the documentation so it’s clear for users and decide later whether to make a breaking fix

0reactions
arunppsgcommented, Oct 7, 2021

Docs fixes in #2712

Read more comments on GitHub >

github_iconTop Results From Across the Web

tune-sklearn/tune_search.py at master · ray-project ... - GitHub
A drop-in replacement for Scikit-Learn's GridSearchCV / RandomizedSearchCV -- but with cutting edge hyperparameter tuning techniques.
Read more >
How to Grid Search Hyperparameters for Deep Learning ...
Grid search is a model hyperparameter optimization technique. In scikit-learn, this technique is provided in the GridSearchCV class. When ...
Read more >
Source code for chemprop.args
!= 2: raise ValueError(f'In reaction_solvent mode, exactly two smiles column must be provided (one for reactions, and one for molecules)') # Validate reaction/ ......
Read more >
Source code for autogluon.multimodal.predictor
The prediction can be either classification or regression. The feature columns can contain image paths, text, numerical, and categorical values.
Read more >
tune_sklearn.tune_search — Ray 2.2.0 - the Ray documentation
Hyperparameter ): raise ValueError( "distribution must be a tuple, list, ... The parameters of the estimator used to apply these methods are optimized...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found