automl / automl/ConfigSpace

How to update/delete a Hyperparameter from ConfigSpace?

Open
#296 3 comments 1 reaction 1 assignee Claimed by @thijssnelleman View on GitHub
question
Dominant language
Python
Stars
225
Forks
94
PR merge metrics
No merged PRs in 30d

Description

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
```python
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:
```python
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.