3

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.

natedjurus
  • 319
  • 3
  • 11

2 Answers2

8

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

from hyperopt import hp

You have used

import hyperopt as hp
CDJB
  • 14,043
  • 5
  • 29
  • 55
2

Hyperopt has inbuilt module hp which has the function uniform within it

import hyperopt.hp as hp

and then hp.uniform would work fine for you. This works good with networkx-2.2.

MartenCatcher
  • 2,713
  • 8
  • 26
  • 39