Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling problem with quantized UniformIntegerHyperparameter #119

Closed
mzeiseSAP opened this issue Jun 27, 2019 · 1 comment
Closed

Sampling problem with quantized UniformIntegerHyperparameter #119

mzeiseSAP opened this issue Jun 27, 2019 · 1 comment

Comments

@mzeiseSAP
Copy link
Contributor

Context

Configuration space with a uniform integer hyperparameter with quantization (see example code below)

Problem

When sampling more than one configuration at a time (size>1), a type error is thrown (see stack trace below). The error seems to be related to the transformation and following the inverse transformation of the underlying sampled raw float value(s) and a mismatch of parameter types (vector vs. scalar). To my knowledge, only the UniformIntegerHyperparameter class is affected.

Example code

import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH

cs = CS.ConfigurationSpace()
cs.add_hyperparameter(CSH.UniformIntegerHyperparameter("a", lower=1, upper=10, q=1))

cs.sample_configuration(size=1) # works
cs.sample_configuration(size=2) # fails

Stack trace for example code

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    cs.sample_configuration(size=2) # fails
  File "ConfigSpace/configuration_space.pyx", line 1265, in ConfigSpace.configuration_space.ConfigurationSpace.sample_configuration
  File "ConfigSpace/hyperparameters.pyx", line 799, in ConfigSpace.hyperparameters.UniformIntegerHyperparameter._sample
  File "ConfigSpace/hyperparameters.pyx", line 806, in ConfigSpace.hyperparameters.UniformIntegerHyperparameter._transform
  File "ConfigSpace/hyperparameters.pyx", line 495, in ConfigSpace.hyperparameters.UniformFloatHyperparameter._transform
TypeError: only size-1 arrays can be converted to Python scalars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants