randint returns index or value?

15 views
Skip to first unread message

Joris Mattheijssens

unread,
Dec 12, 2023, 3:27:34 AM12/12/23
to hyperopt-discuss
Hi,

I am optimizing this parameter space:
space = {
    'blur_kernel_size':  hyperopt.hp.choice("blur_kernel_size", np.arange(1,25,2)),
    'blur_kernel_denom': hyperopt.hp.lognormal("blur_kernel_denom", mu = 20, sigma = 10),
    'threshold_min':     hyperopt.hp.uniform("threshold_min", low = 0, high = 1),
    'dilate_iterations': hyperopt.hp.randint("dilate_iterations", low = 0, high = 5),
    'erode_iterations':  hyperopt.hp.randint("erode_iterations", low = 0, high = 5),
    'erode_kernel_size': hyperopt.hp.choice("erode_kernel_size", np.arange(1,25,2)),
}

Output of the algorithm is:
{'blur_kernel_denom': 0.05012712287194125, 'blur_kernel_size': 2, 'dilate_iterations': 2, 'erode_iterations': 4, 'erode_kernel_size': 5, 'threshold_min': 0.3408662748870931}

It is clear to me that parameters of type hyperopt.hp.choice return the index of the best parameter value. E.g. the possible values for erode_kernel size are odd numbers between and , i.e. [1,3,5,7,9,...25].  The best index is 5, hence the best value is 9.  Please correct me if I am wrong.

For parameters of type hyperopt.hp.randint, this is mot clear to me.  Does the algorithm return the best index, like it does for hyperopt.hp.choice, or the best value, as for hyperopt.hp.uniform?

Many thanks,

Joris
Reply all
Reply to author
Forward
0 new messages