Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'hyperopt' has no attribute 'uniform'

I am trying to define a parameter space in hyperopt. However, when I run:

import hyperopt as hp
SPACE = {'d1': hp.uniform('d1',-1000000,-0.5),
'd2': hp.uniform('d2',0,1),
'd3': hp.uniform('d3',0,1)} 

I receive the error in the title. The only thing I found online was that I should try downgrading to networkx 1.11, so in the command prompt I ran:

pip install networkx==1.11

and it apparently worked, but still no luck with the attribute uniform.

like image 211
natedjurus Avatar asked Dec 14 '25 02:12

natedjurus


1 Answers

The correct way to import the hp part of the hyperopt module is

from hyperopt import hp

You have used

import hyperopt as hp
like image 138
CDJB Avatar answered Dec 16 '25 17:12

CDJB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!