ConfigSpace
ConfigSpace copied to clipboard
Allow for hyperparameter sampling without an explicit random state required.
In theory, I don't see why this shouldn't be possible other than it adds an if check to the sample which may be a speed thing? In general, it would be also nice to have some documentation listed somewhere that motivates the decision for Cython as it makes it scary to change as I'm not sure where the bottleneck of things occur or how to benchmark it.
from ConfigSpace import UniformIntegerHyperparameter
u = UniformIntegerHyperparameter("u", 1, 10)
u.sample() # TypeError sample() takes exactly one argument (0 given)
# hyperparameters.pyx
class HyperParameter:
def sample(self, rs: RandomState):
v = self._sample(rs)
...
class UniformIntegerHyperparameter:
def _sample(self, rs: RandomState, size: int | None):
...
I usually use https://github.com/automl/ConfigSpace/blob/master/scripts/benchmark_sampling.py to benchmark changes. Probably we should improve that script and document how to use it.
Now possible in #346