PB2 Hyper-parameters as Integers?

Hi,

I’m trying to use PB2 with hyper-parameters specified as follows:

search_space = {
    'fast_period': [3,30],
    'liquidate': [0,1],
    'should_cancel': [True, False],
}


pb2 = PB2(
    time_attr='training_iteration',
    perturbation_interval=perturbation_interval,
    require_attrs=False,
    hyperparam_bounds=search_space
    )

When i execute i run into an error because my trainable function requires parameters to be as integers.

Is there some way I can specify that the sampled hyperparameters should be integers when using the PB2 scheduler? I wasn’t able to find much in the docs.

with PBT i was able to specify integer perturbations like this :

hyperparams_mutations = {
    'fast_period': tune.qrandint(3,30,1),
    'liquidate': [0,1],
    'should_cancel': [True, False],
}

search_space = {
    'fast_period': tune.qrandint(3,30,1),
    'liquidate': tune.choice([0,1]),
    'should_cancel': tune.choice([True, False]),
}

Hi @l-j-g,

It looks like PBT has a way to do this with a custom explore function that can be used to post-process perturbed values (i.e. casting to int if needed), but PB2 does not. This can be added to PB2 to have the same behavior. Feel free to create a github issue to track this request!

One way to get around this for now is to do the casting/conversion within your trainable function, when loading the hyperparameters from the config.

Hello guys! I am interested in this issue aswell. I have been thinking abour modifying the source code by chaining the pb2_explore with my own custom version. Does this github already exist?