Skip to content

None in CategoricalHyperparamter can cause invalid configuration #104

@JarnoRFB

Description

@JarnoRFB

Let's say I categorical hyperparameter can either be a string or None since it is optional. It is not possible to do

cs = CS.ConfigurationSpace()
cs.add_hyperparameter(
    CSH.CategoricalHyperparameter('expected_numbers_method', choices=[None, 'numeric', 'glm']),  
)

but, switching the order of the arguments in the list works

cs = CS.ConfigurationSpace()
cs.add_hyperparameter(
    CSH.CategoricalHyperparameter('expected_numbers_method', choices=['numeric', 'glm', None]),  
)

The exception is raised when checking the default configuration of a new hyperparameter here.
The problem seems to be that the first entry in the choices list is treated as a default value. However, setting None as a value, does not set None as the value of the hyperparameter, but rather excludes this hyperparameter from the configuration. This is a bit surprising and intuitive from a users perspective.
This issue seems related to #73 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions