Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update/delete a Hyperparameter from ConfigSpace? #296

Open
Doglovesfish opened this issue Feb 9, 2023 · 0 comments
Open

How to update/delete a Hyperparameter from ConfigSpace? #296

Doglovesfish opened this issue Feb 9, 2023 · 0 comments

Comments

@Doglovesfish
Copy link

Doglovesfish commented Feb 9, 2023

1.I want to update a Hyperparameter from ConfigSpace. Is there any API to do update/delete a Hyperparameter from ConfigSpace?

2.I also found that add_hyperparameters can't override the existed Hyperparameter. If I want to change upper and lower, I have to do this like

    hp = cs.get_hyperparameter(hp_name)
    hp.lower = 180
    hp.upper = 181
    hp.default_value = 180

In this way, a bug might occur. The following code cannot be executed:

from ConfigSpace import ConfigurationSpace, ForbiddenEqualsClause
from ConfigSpace import UniformIntegerHyperparameter


def get_configspace():
    cs = ConfigurationSpace()
    hp_name = 'cpu_num'
    hp_a = UniformIntegerHyperparameter(hp_name, 1, 10, default_value=6)
    cs.add_hyperparameter(hp_a)

    # change cs
    hp = cs.get_hyperparameter(hp_name)
    hp.lower = 180
    hp.upper = 200
    hp.default_value = 190

    # check
    print(cs)
    print(cs["cpu_num"])

    config = cs.sample_configuration()
    print(config)

    forbidden_clause_a = ForbiddenEqualsClause(cs[hp_name], 181)
    cs.add_forbidden_clause(forbidden_clause_a)


if __name__ == '__main__':
    cs = get_configspace()

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant