{"id":19530032,"url":"https://github.com/goktug97/bohb-hpo","last_synced_at":"2025-04-26T12:30:36.267Z","repository":{"id":138256479,"uuid":"324798150","full_name":"goktug97/bohb-hpo","owner":"goktug97","description":"Bayesian Optimization Hyperband Hyperparameter Optimization","archived":false,"fork":false,"pushed_at":"2021-01-03T15:11:20.000Z","size":54,"stargazers_count":38,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T12:22:02.272Z","etag":null,"topics":["bayesian","bayesian-optimization","bohb","hpo","hyperband","hyperparameter-optimization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goktug97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-12-27T16:07:06.000Z","updated_at":"2024-12-21T12:10:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d4bd702-359d-4838-a3c8-477fc5677d0b","html_url":"https://github.com/goktug97/bohb-hpo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goktug97%2Fbohb-hpo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goktug97%2Fbohb-hpo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goktug97%2Fbohb-hpo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goktug97%2Fbohb-hpo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goktug97","download_url":"https://codeload.github.com/goktug97/bohb-hpo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250986192,"owners_count":21518459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian","bayesian-optimization","bohb","hpo","hyperband","hyperparameter-optimization"],"created_at":"2024-11-11T01:28:34.396Z","updated_at":"2025-04-26T12:30:35.916Z","avatar_url":"https://github.com/goktug97.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Bayesian Optimization Hyperband Hyperparameter Optimization\n===========================================================\n\nImplementation for [BOHB](http://proceedings.mlr.press/v80/falkner18a.html)\n\n## Requirements\n    - numpy\n    - scipy\n    - statsmodels\n    - dask\n    - torch (example)\n\n## Installation\n```bash\npip3 install bohb-hpo\n```\n\n## Usage\n\n``` Python\nfrom bohb import BOHB\nimport bohb.configspace as cs\n\n\ndef objective(step, alpha, beta):\n    return 1 / (alpha * step + 0.1) + beta\n\n\ndef evaluate(params, n_iterations):\n    loss = 0.0\n    for i in range(int(n_iterations)):\n        loss += objective(**params, step=i)\n    return loss/n_iterations\n\n\nif __name__ == '__main__':\n    alpha = cs.CategoricalHyperparameter('alpha', [0.001, 0.01, 0.1])\n    beta = cs.CategoricalHyperparameter('beta', [1, 2, 3])\n    configspace = cs.ConfigurationSpace([alpha, beta])\n\n    opt = BOHB(configspace, evaluate, max_budget=10, min_budget=1)\n\n    # Parallel\n    # opt = BOHB(configspace, evaluate, max_budget=10, min_budget=1, n_proc=4)\n\n    logs = opt.optimize()\n```\n\nSee [examples](https://github.com/goktug97/bohb-hpo/tree/master/examples)\n\n### Configspace Examples\n\n- Basic\n```python\nimport dehb.configspace as cs\nlr = cs.UniformHyperparameter('lr', 1e-4, 1e-1, log=True)\nbatch_size = cs.CategoricalHyperparameter('batch_size', [8, 16, 32])\nconfigspace = cs.ConfigurationSpace([lr, batch_size], seed=123)\n```\n\n- Conditional Parameters\n```python\nimport bohb.configspace as cs\na = cs.IntegerUniformHyperparameter('a', 0, 4)\nb = cs.CategoricalHyperparameter('b', ['a', 'b', 'c'], a == 0)\nb_default = cs.CategoricalHyperparameter('b', ['d'], ~b.cond)\nconfigspace = cs.ConfigurationSpace([a, b, b_default], seed=123)\n```\n\n- Complex Conditional Parameters\n```python\nimport bohb.configspace as cs\na = cs.IntegerUniformHyperparameter('a', 0, 4)\nb1 = cs.UniformHyperparameter('b', 0, 0.5, a \u003c= 1)\nb2 = cs.UniformHyperparameter('b', 0.5, 1, ~b1.cond)\nc1 = cs.CategoricalHyperparameter('c', ['a', 'b', 'c'], b1 \u003c 0.25)\nc2 = cs.CategoricalHyperparameter('c', ['c', 'd', 'e'], ~c1.cond)\nd1 = cs.UniformHyperparameter('d', 0, 1, (b1 \u003c 0.125) \u0026 (c1 == 'b'))\nd2 = cs.NormalHyperparameter('d', 0, 0.1, (b1 \u003e 0.125) \u0026 (c1 == 'c'))\nd3 = cs.IntegerNormalHyperparameter('d', 5, 10, (b2 \u003e 0.750) \u0026 (c2 == 'd'))\nd4 = cs.UniformHyperparameter('d', 0, 0, ~(d1.cond | d2.cond | d3.cond))\nconfigspace = cs.ConfigurationSpace([a, b1, b2, c1, c2, d1, d2, d3, d4], seed=123)\n```\n\n\n## License\nbohb-hpo is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoktug97%2Fbohb-hpo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoktug97%2Fbohb-hpo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoktug97%2Fbohb-hpo/lists"}