{"data":{"slug":"zygmuntz-hyperband","name":"hyperband","tagline":"Tuning hyperparams fast with Hyperband","github_url":"https://github.com/zygmuntz/hyperband","owner":"zygmuntz","repo":"hyperband","owner_avatar_url":"https://avatars.githubusercontent.com/u/1714767?v=4","primary_language":"Python","stars":598,"forks":73,"topics":["gradient-boosting","gradient-boosting-classifier","hyperparameter-optimization","hyperparameter-tuning","hyperparameters","machine-learning"],"archived":false,"github_pushed_at":"2018-08-15T09:21:05+00:00","maintenance_label":"Dormant","url":"https://www.graphcanon.com/tools/zygmuntz-hyperband","markdown_url":"https://www.graphcanon.com/tools/zygmuntz-hyperband.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/zygmuntz-hyperband","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=zygmuntz-hyperband","description":"Tuning hyperparams fast with Hyperband","homepage_url":"http://fastml.com/tuning-hyperparams-fast-with-hyperband/","license":"Other","open_issues":9,"watchers":18,"ai_summary":null,"readme_excerpt":"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 descrip","github_created_at":"2017-02-26T21:33:42+00:00","created_at":"2026-07-11T23:34:42.746522+00:00","updated_at":"2026-07-11T23:34:51.120026+00:00","categories":[{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"}],"tags":[{"slug":"machine-learning","name":"machine-learning"},{"slug":"python","name":"python"},{"slug":"gradient-boosting","name":"gradient-boosting"},{"slug":"hyperparameter-tuning","name":"hyperparameter-tuning"},{"slug":"gradient-boosting-classifier","name":"gradient-boosting-classifier"},{"slug":"hyperparameters","name":"hyperparameters"},{"slug":"hyperparameter-optimization","name":"hyperparameter-optimization"}],"trust":{"provenance":{"is_fork":false,"github_id":83242270,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-07-11T23:34:45.373Z","maintenance":{"label":"Dormant","score":18,"methodology":"github_public_v1","releases_90d":0,"days_since_push":2887,"last_release_at":null},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T23:34:45.873Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-07-11T23:34:45.120Z"},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-07-11T23:34:45.120Z"},"license_spdx":{"value":"Other","source":"github.license","observed_at":"2026-07-11T23:34:45.120Z"}}}}