When we request both float and int parameters in Bayesian optimization, right now sherpa returns all parameters as float. This is due to some pandas behavior which casts int values to float when taking the transpose of the data frame. This PR fixes this and adds a test to ensure the proper behavior.
The steps to reproduce this issue are as follows:
import sherpa
algorithm = sherpa.algorithms.GPyOpt(max_num_trials=4)
parameters = [
sherpa.Choice('param_int', [0, 1]),
sherpa.Choice('param_float', [0.1, 1.1]),
]
study = sherpa.Study(
parameters=parameters,
algorithm=algorithm,
lower_is_better=True,
disable_dashboard=True,
)
for trial in study:
study.add_observation(trial, iteration=0, objective=0)
study.finalize(trial)
assert type(trial.parameters['param_int']) == int
assert type(trial.parameters['param_float']) == float
When we request both float and int parameters in Bayesian optimization, right now sherpa returns all parameters as float. This is due to some
pandas
behavior which casts int values to float when taking the transpose of the data frame. This PR fixes this and adds a test to ensure the proper behavior.The steps to reproduce this issue are as follows: