ConfigSpace icon indicating copy to clipboard operation
ConfigSpace copied to clipboard

quantized Normal and Uniform Int/Float have different quantization points

Open eddiebergman opened this issue 3 years ago • 3 comments

from ConfigSpace import NormalIntegerHyperparameter, UniformIntegerHyperparameter

# Same bounds and q
u = UniformIntegerHyperparameter("u", 1, 10, q=3)
n = NormalIntegerHyperparameter("n", mu=5, sigma=2, q=3, lower=1, upper=10)

set([n.sample(rs) for _ in range(100)])
# {0, 3, 6, 9}

set([u.sample(rs) for _ in range(100)])
# {1, 4, 7, 10}

Given the same boundaries, I imagine the quantization points would be equal

eddiebergman avatar Jun 28 '22 11:06 eddiebergman

That's a great finding. I think this should be handled as part or after #252.

mfeurer avatar Jun 30 '22 06:06 mfeurer

Bit more discovered while writing docs.

Turns out we have the same for the Float variants as well but it's a little worse with bounding on Normal's.


rs = np.random.RandomState()
u = UniformFloatHyperparameter("u", 1.0, 10.0, q=3)

set({u.sample(rs) for _ in range(100)})
# {1.0, 4.0, 7.0, 10.0}


n = NormalFloatHyperparameter("n", mu=5, sigma=3, q=3, lower=1, upper=10)
set({n.sample(rs) for _ in range(100)})
# {0.0, 3.0, 6.0, 9.0, 12.0}

eddiebergman avatar Jul 01 '22 09:07 eddiebergman

Closed by #346 which removes quantization

eddiebergman avatar Apr 16 '24 18:04 eddiebergman