Skip to content

Sampling multiple quantized UniformIntegerHyperparameters gives floats #262

@eddiebergman

Description

@eddiebergman
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions