{"id":13578777,"url":"https://github.com/zygmuntz/hyperband","last_synced_at":"2026-01-28T16:53:13.832Z","repository":{"id":53182207,"uuid":"83242270","full_name":"zygmuntz/hyperband","owner":"zygmuntz","description":"Tuning hyperparams fast with Hyperband","archived":false,"fork":false,"pushed_at":"2018-08-15T09:21:05.000Z","size":379,"stargazers_count":593,"open_issues_count":9,"forks_count":75,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-05T16:48:42.946Z","etag":null,"topics":["gradient-boosting","gradient-boosting-classifier","hyperparameter-optimization","hyperparameter-tuning","hyperparameters","machine-learning"],"latest_commit_sha":null,"homepage":"http://fastml.com/tuning-hyperparams-fast-with-hyperband/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zygmuntz.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}},"created_at":"2017-02-26T21:33:42.000Z","updated_at":"2024-10-28T02:52:28.000Z","dependencies_parsed_at":"2022-09-15T01:25:21.309Z","dependency_job_id":null,"html_url":"https://github.com/zygmuntz/hyperband","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/zygmuntz%2Fhyperband","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zygmuntz%2Fhyperband/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zygmuntz%2Fhyperband/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zygmuntz%2Fhyperband/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zygmuntz","download_url":"https://codeload.github.com/zygmuntz/hyperband/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393095,"owners_count":20931804,"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":["gradient-boosting","gradient-boosting-classifier","hyperparameter-optimization","hyperparameter-tuning","hyperparameters","machine-learning"],"created_at":"2024-08-01T15:01:33.673Z","updated_at":"2026-01-28T16:53:13.802Z","avatar_url":"https://github.com/zygmuntz.png","language":"Python","funding_links":[],"categories":["Python","AutoML","Profiling","Scheduling","Libraries","Tools and projects"],"sub_categories":["Profiling","LLM"],"readme":"hyperband\n=========\n\nCode for tuning hyperparams with Hyperband, adapted from [Hyperband: A Novel Bandit-Based Approach to Hyperparameter Optimization](https://people.eecs.berkeley.edu/~kjamieson/hyperband.html). \n\n\tdefs/ - functions and search space definitions for various classifiers\n\tdefs_regression/ - the same for regression models\n\tcommon_defs.py - imports and definitions shared by defs files\n\thyperband.py - from hyperband import Hyperband\n\t\n\tload_data.py - classification defs import data from this file\n\tload_data_regression.py - regression defs import data from this file\n\t\n\tmain.py - a complete example for classification\n\tmain_regression.py - the same, for regression\n\tmain_simple.py - a simple, bare-bones, example\t\n\nThe goal is to provide a fully functional implementation of Hyperband, as well as a number of ready to use functions for a number of models (classifiers and regressors). Currently these include four from _scikit-learn_ and four others:\n\n* gradient boosting (GB)\n* random forest (RF)\n* extremely randomized trees (XT)\n* linear SGD\n* factorization machines from polylearn\n* polynomial networks from polylearn\n* a multilayer perceptron from Keras\n* gradient boosting from XGBoost (classification only)\n\nMeta-classifier/regressor\n-------------------------\n\nUse `defs.meta`/`defs_regression.meta` to try many models in one Hyperband run. This is an automatic alternative to constructing search spaces with multiple models (like `defs.rf_xt`, or `defs.polylearn_fm_pn`) by hand.\n\nLoading data\n------------\n\nDefinitions files in `defs`/`defs_regression` import data from `load_data.py` and `load_data_regression.py`, respectively.\n\nEdit these files, or a definitions file directly, to make your data available for tuning.\n\nRegression defs use the _kin8nm_ dataset in `data/kin8nm`. There is no attached data for classification.\n\nFor the provided models data format follows _scikit-learn_ conventions, that is, there are _x_train_, _y_train_, _x_test_ and _y_test_ Numpy arrays.\n\nUsage\n-----\n\nRun `main.py` (with your own data), or `main_regression.py`. The essence of it is\n\n```python\nfrom hyperband import Hyperband\nfrom defs.gb import get_params, try_params\n\nhb = Hyperband( get_params, try_params )\nresults = hb.run()\n```\n\nHere's a sample output from a run (three configurations tested) using `defs.xt`:\n\n\t3 | Tue Feb 28 15:39:54 2017 | best so far: 0.5777 (run 2)\n\n\tn_estimators: 5\n\t{'bootstrap': False,\n\t'class_weight': 'balanced',\n\t'criterion': 'entropy',\n\t'max_depth': 5,\n\t'max_features': 'sqrt',\n\t'min_samples_leaf': 5,\n\t'min_samples_split': 6}\n\n\t# training | log loss: 62.21%, AUC: 75.25%, accuracy: 67.20%\n\t# testing  | log loss: 62.64%, AUC: 74.81%, accuracy: 66.78%\n\n\t7 seconds.\n\n\t4 | Tue Feb 28 15:40:01 2017 | best so far: 0.5777 (run 2)\n\n\tn_estimators: 5\n\t{'bootstrap': False,\n\t'class_weight': None,\n\t'criterion': 'gini',\n\t'max_depth': 5,\n\t'max_features': 'sqrt',\n\t'min_samples_leaf': 1,\n\t'min_samples_split': 2}\n\n\t# training | log loss: 53.39%, AUC: 75.69%, accuracy: 72.37%\n\t# testing  | log loss: 53.96%, AUC: 75.29%, accuracy: 71.89%\n\n\t7 seconds.\n\n\t5 | Tue Feb 28 15:40:07 2017 | best so far: 0.5396 (run 4)\n\n\tn_estimators: 5\n\t{'bootstrap': True,\n\t'class_weight': None,\n\t'criterion': 'gini',\n\t'max_depth': 3,\n\t'max_features': None,\n\t'min_samples_leaf': 7,\n\t'min_samples_split': 8}\n\n\t# training | log loss: 50.20%, AUC: 77.04%, accuracy: 75.39%\n\t# testing  | log loss: 50.67%, AUC: 76.77%, accuracy: 75.12%\n\n\t8 seconds.\n\t\nEarly stopping\n--------------\n\nSome models may use early stopping (as the Keras MLP example does). If a configuration  stopped early, it doesn't make sense to run it with more iterations (duh). To indicate this, make `try_params()`\n\n```python\nreturn { 'loss': loss, 'early_stop': True }\n```\n\t\nThis way, Hyperband will know not to select that configuration for any further runs.\n\nMoar\n----\n\nSee [http://fastml.com/tuning-hyperparams-fast-with-hyperband/](http://fastml.com/tuning-hyperparams-fast-with-hyperband/) for a detailed description.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzygmuntz%2Fhyperband","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzygmuntz%2Fhyperband","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzygmuntz%2Fhyperband/lists"}