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

YAHPO problem wrapper changes dict representation of a config after evaluating that config #19

Closed
sumny opened this issue Jun 9, 2023 · 0 comments · Fixed by #23
Closed

Comments

@sumny
Copy link
Collaborator

sumny commented Jun 9, 2023

Somewhat weird bug:

from pbmohpo.problems.yahpo import YAHPO

problem = YAHPO("iaml_xgboost", instance = "40981", objective_names = ["mmce", "nf"])
problem.get_config_space()

problem.fix_hps = {"booster": "gbtree", "trainsize" : 1}
cs = problem.get_config_space()
cs.seed(0)
x = cs.sample_configuration(1)
# looks as expected
x.get_dictionary()
{'alpha': 0.6945356257424766,
 'colsample_bylevel': 0.7180374727086953,
 'colsample_bytree': 0.6067357423109274,
 'eta': 0.01511933646764101,
 'gamma': 0.011288832727483048,
 'lambda': 3.3209228886981608,
 'max_depth': 7,
 'min_child_weight': 97.18110224911669,
 'nrounds': 1569,
 'subsample': 0.4450973669431999}
problem(x)
{'mmce': -0.49803417921066284, 'nf': -0.0}
x.get_dictionary()
# now also includes the fixed hyperparameters from `problem.fix_hps`  which is unintended behavior
{'alpha': 0.6945356257424766,
 'colsample_bylevel': 0.7180374727086953,
 'colsample_bytree': 0.6067357423109274,
 'eta': 0.01511933646764101,
 'gamma': 0.011288832727483048,
 'lambda': 3.3209228886981608,
 'max_depth': 7,
 'min_child_weight': 97.18110224911669,
 'nrounds': 1569,
 'subsample': 0.4450973669431999,
 'task_id': '40981',
 'booster': 'gbtree',
 'trainsize': 1}

to fix this we should work with a deepcopy within the YAHPO wrapper https://github.com/ja-thomas/pbmohpo/blob/d0e5ae3db39cad3b9f8068bae1fbe57ddc2ca6ea/pbmohpo/problems/yahpo.py#LL68C1-L68C1

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

Successfully merging a pull request may close this issue.

1 participant