ConfigSpace icon indicating copy to clipboard operation
ConfigSpace copied to clipboard

Sampling multiple quantized UniformIntegerHyperparameters gives floats

Open eddiebergman opened this issue 3 years ago • 1 comments

import numpy as np
from ConfigSpace import UniformIntegerHyperparameter

u = UniformIntegerHyperparameter("u", 1, 10, q=3)

rs = np.random.RandomState(3)
u._sample(rs, 10)
Out[21]: 
array([0.0499991, 0.3499997, 0.6500003, 0.3499997, 0.6500003, 0.6500003,
       0.0499991, 0.6500003, 0.3499997, 0.3499997])

It is a private method but it's got the size parameter that the public sample is missing. The workaround

samples = [u.sample(rs) for _ in range(10)]

Enhancement would just be add this as a parameter to public sample

eddiebergman avatar Jun 28 '22 11:06 eddiebergman

Removed quantization in #346

eddiebergman avatar Apr 16 '24 18:04 eddiebergman