Issue
I am trying to run optimization using optuna
:
study = optuna.create_study(direction='minimize', sampler=optuna.samplers.GridSampler(search_space))
study.optimize(objective, n_trials=20)
For which I am getting below error:
AttributeError: module optuna.samplers has no attribute GridSampler
optuna
version is 0.10.0
Could someone please help me on how to fix this issue.
Solution
I tried to reproduce your example:
pip install optuna==0.10.0
Then:
print(dir(optuna.samplers))
#output
['BaseSampler',
'RandomSampler',
'TPESampler',
'__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__',
'base',
'random',
'tpe']
I see that we do not have GridSampler
You need to upgrade your optuna
pip install optuna --upgrade
#Successfully installed optuna-3.4.0
Now,
print(dir(optuna.samplers))
#output
['BaseSampler',
'BruteForceSampler',
'CmaEsSampler',
'GridSampler',
'IntersectionSearchSpace',
'MOTPESampler',
'NSGAIIISampler',
'NSGAIISampler',
'PartialFixedSampler',
'QMCSampler',
'RandomSampler',
'TPESampler',
'__all__',
'__builtins__',
'__cached__',
'__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__',
'_base',
'_brute_force',
'_cmaes',
'_grid',
'_lazy_random_state',
'_nsgaiii',
'_partial_fixed',
'_qmc',
'_random',
'_search_space',
'_tpe',
'intersection_search_space',
'nsgaii']
Answered By - Goku - stands with Palestine
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.