ConfigSpace icon indicating copy to clipboard operation
ConfigSpace copied to clipboard

How to create a set of possible configurations (union)?

Open bmartinn opened this issue 4 years ago • 3 comments

Hi Guys,

I'd like to create a set of possible configuration spaces and then create a union of them, for example:

cat_hp1 = CSH.CategoricalHyperparameter('cat_hp', choices=['red', 'green', 'blue'])
uniform_integer_hp1 = CSH.UniformIntegerHyperparameter(name='uni_int', lower=10, upper=100))
cs_set1.add_hyperparameters([cat_hp1, uniform_integer_hp1])

cat_hp2 = CSH.CategoricalHyperparameter('cat_hp', choices=['cyan', 'magenta', 'yellow', 'black])
uniform_integer_hp2 = CSH.UniformIntegerHyperparameter(name='uni_int', lower=1, upper=10))
cs_set2.add_hyperparameters([cat_hp2, uniform_integer_hp2])

Then combine these two into one configuration space cs_union and sample from it, is that possible ?

bmartinn avatar May 16 '20 22:05 bmartinn

There's a function called add_configuration_space with which you can add one configuration space to another.

mfeurer avatar May 25 '20 07:05 mfeurer

Thanks @mfeurer ! From what I understand add_configuration_space will sample from all added configurations, is that correct ? I'm looking for "kind of conditional?!" , for example let's assume I added two configuration "first" and "second" by calling add_configuration_space. I would like to sample from either "first" or "second" , but not both, then on the selected sub-configuration sample it's variables as usual. Is that possible ?

bmartinn avatar May 25 '20 21:05 bmartinn

There's an argument parent_hyperparameter that should do what you want here.

mfeurer avatar Dec 14 '21 14:12 mfeurer