ConfigSpace icon indicating copy to clipboard operation
ConfigSpace copied to clipboard

Allow callbacks or objects to be passed to `CategoricalHyperparameter`

Open ThibzR opened this issue 6 years ago • 2 comments

Currently there is no way to pass an object (not int, float or str) when declaring a set of CategoricalHyperparameter.

Would be very nice to be able to do something like: CategoricalHyperparameter('final_activation', [nn.Softmax(dim=1), nn.Sigmoid()])

Or a callable like CategoricalHyperparameter('final_activation', [lambda : nn.Softmax(dim=4)])

Currently I have to pass a string saying 'softmax', check for that value in the model and create corresponding layer - this would allow to be less verbose while gaining in simplicity.

ThibzR avatar Oct 29 '19 15:10 ThibzR

Thanks for your suggestion. Indeed, this would be less verbose and simpler from a user perspective. We would have to check how this interacts with the fact that the hyperparameters are cython classes.

mfeurer avatar Oct 31 '19 16:10 mfeurer

This was added in #359 which depends on #346. Arbitrary objects are now allowed in Categorical or Ordinals :) Was tested with conditionals and forbiddens as well as other critical opererations regarding sampling, neighborhoods and conversions.

eddiebergman avatar Apr 16 '24 19:04 eddiebergman