{ "info": { "author": "Curtis G. Northcutt", "author_email": "cgn@mit.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "\n``hypopt``\n================\n\n|pypi| |py_versions| |build_status| |coverage|\n\n.. |pypi| image:: https://img.shields.io/pypi/v/hyperopt.svg\n :target: https://pypi.org/pypi/hypopt/\n.. |py_versions| image:: https://img.shields.io/pypi/pyversions/hypopt.svg\n :target: https://pypi.org/pypi/hypopt/\n.. |build_status| image:: https://travis-ci.com/cgnorthcutt/hypopt.svg?branch=master\n :target: https://travis-ci.com/cgnorthcutt/hypopt\n.. |coverage| image:: https://codecov.io/gh/cgnorthcutt/hypopt/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/cgnorthcutt/hypopt\n\n\n\nA Python machine learning package for grid search **hyper-parameter optimization using a validation set** (defaults to cross validation when no validation set is available). This package works for Python 2.7+ and Python 3+, for any model (classification and regression), and **runs in parallel on all threads on your CPU automatically**.\n\n``scikit-learn`` provides a package for `grid-search hyper-parameter optimization **using cross-validation** on the training dataset `_. Unfortunately, cross-validation is impractically slow for large datasets and fails for small datasets due to the lack of data in each class needed to properly train each fold. Instead, we use a constant validation set to optimize hyper-parameters -- the ``hypopt`` package makes this fast (distributed on all CPU threads) and easy (one line of code).\n\n``hypopt.model_selection.fit_model_with_grid_search`` supports grid search hyper-parameter optimization **when you already have a validation set** , eliminating the extra hours of training time required when using cross-validation. However, when no validation set is given, it defaults to using cross-validation on the training set. This allows you to alows use ``hypopt`` anytime you need to do hyper-parameter optimization with grid-search, regardless of whether you use a validation set or cross-validation.\n\nInstallation\n------------\n\nPython 2.7, 3.4, 3.5, and 3.6 are supported.\n\nStable release:\n\n.. code-block::\n\n $ pip install hypopt\n\nDeveloper (unstable) release:\n\n.. code-block::\n\n $ pip install git+https://github.com/cgnorthcutt/hypopt.git\n\nTo install the codebase (enabling you to make modifications):\n\n.. code-block::\n\n $ conda update pip # if you use conda\n $ git clone https://github.com/cgnorthcutt/hypopt.git\n $ cd hypopt\n $ pip install -e .\n\nExamples\n--------\n\nBasic usage\n^^^^^^^^^^^\n\n.. code-block:: python\n\n # Assuming you already have train, test, val sets and a model.\n from hypopt import GridSearch\n param_grid = [\n {'C': [1, 10, 100], 'kernel': ['linear']},\n {'C': [1, 10, 100], 'gamma': [0.001, 0.0001], 'kernel': ['rbf']},\n ]\n # Grid-search all parameter combinations using a validation set.\n gs = GridSearch(model = SVR(), param_grid = param_grid)\n gs.fit(X_train, y_train, X_val, y_val)\n print('Test Score for Optimized Parameters:', gs.score(X_test, y_test))\n\nChoosing the scoring metric to optimize\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe default metric is the the ``model.score()`` function, so in the previous example ``SVR().score()`` is optimized, which defaults to accuracy.\n\nIt's easy to use a different scoring metric using the ``scoring`` parameter in ``hypopt.GridSearch.fit()``:\n\n.. code-block:: python\n\n # This will use f1 score as the scoring metric that you optimize.\n gs.fit(X_train, y_train, X_val, y_val, scoring='f1')\n\n* For classification, `hypopt` supports these string-named metrics: 'accuracy', 'brier_score_loss', 'average_precision', 'f1', 'f1_micro', 'f1_macro', 'f1_weighted', 'neg_log_loss', 'precision', 'recall', or 'roc_auc'. \n* For regression, `hypopt` supports: \"explained_variance\", \"neg_mean_absolute_error\", \"neg_mean_squared_error\", \"neg_mean_squared_log_error\", \"neg_median_absolute_error\", \"r2\".\n\nYou can also create your own metric ``your_custom_score_func(y_true, y_pred)`` by wrapping it into an object using `sklearn.metrics.make_scorer `_ like:\n\n.. code-block:: python\n\n from sklearn.metrics import make_scorer\n scorer = make_scorer(your_custom_scoring_func)\n opt.fit(X_train, y_train, X_val, y_val, scoring=scorer)\n\nMinimal working examples\n^^^^^^^^^^^^^^^^^^^^^^^^\n\n\n* `Classification minimal working example `_\n* `Regression minimal working example `_\n\nOther Examples including a working example with MNIST\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\n* `A simple tutorial of the hypopt package. `_\n* `A working example with MNIST. `_\n\nUse ``hypopt`` with any model (PyTorch, Tensorflow, caffe2, scikit-learn, etc.)\n-------------------------------------------------------------------------------------\n\nAll of the features of the ``hypopt`` package work with **any model**. Yes, any model. Feel free to use PyTorch, Tensorflow, caffe2, scikit-learn, mxnet, etc. If you use a scikit-learn model, all ``hypopt`` methods will work out-of-the-box. It's also easy to use your favorite model from a non-scikit-learn package, just wrap your model into a Python class that inherets the ``sklearn.base.BaseEstimator``. Here's an example for a generic classifier:\n\n.. code-block:: python\n\n from sklearn.base import BaseEstimator\n class YourModel(BaseEstimator): # Inherits sklearn base classifier\n def __init__(self, ):\n pass\n def fit(self, X, y, sample_weight = None):\n pass\n def predict(self, X):\n pass\n def score(self, X, y, sample_weight = None):\n pass\n\n # Inherting BaseEstimator gives you these for free!\n # So if you inherit, there's no need to implement these.\n def get_params(self, deep = True):\n pass\n def set_params(self, **params):\n pass\n\nPyTorch MNIST CNN Example\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nCheck out a PyTorch MNIST CNN wrapped in the above class `here `__. You use any object instantion of this class with `hypopt` just as you would any scikit-learn model. Another example of a fully compliant class is the `LearningWithNoisyLabels() model `__.\n\nIf you don't wish to write this code yourself, there are existing packages to do this for you. For PyTorch, check out\nthe ``skorch`` `Python package ` which will wrap your ``pytorch`` model\ninto a ``scikit-learn`` compliant model.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cgnorthcutt/hypopt", "keywords": "machine_learning classification regression hyper-parameter-optimization parameter optimization scikit-learn machine learning cross-validation validation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "hypopt", "package_url": "https://pypi.org/project/hypopt/", "platform": "", "project_url": "https://pypi.org/project/hypopt/", "project_urls": { "Homepage": "https://github.com/cgnorthcutt/hypopt" }, "release_url": "https://pypi.org/project/hypopt/1.0.9/", "requires_dist": [ "numpy (>=1.11.3)", "scikit-learn (>=0.18)" ], "requires_python": "", "summary": "Grid search hyper-parameter optimization using a validation set (not cross validation)", "version": "1.0.9" }, "last_serial": 5595939, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f45bc7056352d8c98c093c724a64d1cc", "sha256": "82d798ebda64ee7fd4932d755becbb0384fb420a668a7d6444074fe387345226" }, "downloads": -1, "filename": "hypopt-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f45bc7056352d8c98c093c724a64d1cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6412, "upload_time": "2018-07-06T17:43:45", "url": "https://files.pythonhosted.org/packages/c0/49/7a0425b0e31989130ab6fe1a4fd35bfb65421c4ae52aad021c6c6330ec40/hypopt-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d8cc391b677a3f07442e890361a0d8f2", "sha256": "d75f3817f798f09bc094468e588dc714e0d6c4c4239370eb8e0f76a4a5b22cb4" }, "downloads": -1, "filename": "hypopt-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d8cc391b677a3f07442e890361a0d8f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6156, "upload_time": "2018-07-06T17:43:46", "url": "https://files.pythonhosted.org/packages/a2/d2/7bac62a1e60b9b63cb72f4b02e9b621e68d4dd55c2a9785210e7b5e60f9a/hypopt-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "62fdf901b7d6ac30d5c4e8aeb6472dcc", "sha256": "ce8a167386c86a68ae33699d64c071090c16a77e53c9e9f040308292df7fee07" }, "downloads": -1, "filename": "hypopt-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "62fdf901b7d6ac30d5c4e8aeb6472dcc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6594, "upload_time": "2018-07-07T10:48:20", "url": "https://files.pythonhosted.org/packages/2d/e8/b8b9d53c50b20159aa692084515897cfc44c86e3b600a951971d4c5b9b06/hypopt-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5e83b8543b5b4143ec77bef04db2ee3", "sha256": "645f67f9f5282b24105fb28a3eff8381118c9f12811c1db3ed2529820b5f42cf" }, "downloads": -1, "filename": "hypopt-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e5e83b8543b5b4143ec77bef04db2ee3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6659, "upload_time": "2018-07-07T10:48:21", "url": "https://files.pythonhosted.org/packages/04/19/7fe7e09e819fbeb410da3a49ed20c541109f697f125af7b71a523fbe94f3/hypopt-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "f3db71b1b4ccfe650ec3cbac1a80bd40", "sha256": "00dccad2740c0ab4149254f37b7ebb6a4a886cab5f94fb5d0abfc743771f18f0" }, "downloads": -1, "filename": "hypopt-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f3db71b1b4ccfe650ec3cbac1a80bd40", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6699, "upload_time": "2018-07-08T00:22:58", "url": "https://files.pythonhosted.org/packages/e8/0d/5b1488c893f3b9caa8b1148e30f023efcc5e504eb62c5365301c75c5451d/hypopt-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "68f0cbd8d77655b7692c5d770dcb29e5", "sha256": "ad22b2c9e957f8e6c836cd1b2a210624d288e9b540d524f445c90a836ea10c71" }, "downloads": -1, "filename": "hypopt-1.0.2.tar.gz", "has_sig": false, "md5_digest": "68f0cbd8d77655b7692c5d770dcb29e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6822, "upload_time": "2018-07-08T00:22:59", "url": "https://files.pythonhosted.org/packages/16/fd/bc134c41542f7f194d1c30474bd6c3754b51393528c916078cd52fa27439/hypopt-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "1e4de4fee6efc6d34bde9274529c53d1", "sha256": "b7f7f48e2c4ee7c7c816b80de705c3b14ae832be882e3425e1265e31a2b17cef" }, "downloads": -1, "filename": "hypopt-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1e4de4fee6efc6d34bde9274529c53d1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6699, "upload_time": "2018-07-08T00:35:55", "url": "https://files.pythonhosted.org/packages/5a/29/1ae04b420825f0b804ff7112dbd109e209a6a47c67e6b83f8667592ee343/hypopt-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6bb4566e8626926a4b98b3254fabe936", "sha256": "f6ddc011d39ddb85bbd526e72d6cc2603b79bc55d43fefdffc950208faa45908" }, "downloads": -1, "filename": "hypopt-1.0.3.tar.gz", "has_sig": false, "md5_digest": "6bb4566e8626926a4b98b3254fabe936", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6829, "upload_time": "2018-07-08T00:35:55", "url": "https://files.pythonhosted.org/packages/c0/74/c196d3ce66cf4d0bf53f42d39786d1778094225ff7c7d0c170ff2c484520/hypopt-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "6cdeec55b908377cfa0bd54dca186270", "sha256": "7a6a99ddc995f3cc0e9973fd087934c4640a909d1babec017f887f5e43ff6a38" }, "downloads": -1, "filename": "hypopt-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6cdeec55b908377cfa0bd54dca186270", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10677, "upload_time": "2018-10-23T06:01:47", "url": "https://files.pythonhosted.org/packages/34/28/166cd4fc6f6679e0d2c154511a55ddc2e85eb27bf6966dd3bef9738ee9da/hypopt-1.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14031ddfde2b00af2475663d7a85ed2c", "sha256": "79ca13d7769fad050d9a9dc290373a9c5568505a2d951341032f18849ab370c3" }, "downloads": -1, "filename": "hypopt-1.0.4.tar.gz", "has_sig": false, "md5_digest": "14031ddfde2b00af2475663d7a85ed2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7845, "upload_time": "2018-10-23T06:01:49", "url": "https://files.pythonhosted.org/packages/e3/4f/c933545566f0d982c9dc3771004bf6bc84cb3ab4be59d3c81a4705831b6b/hypopt-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "6f7a9890f7f9469d0842df59d0a25734", "sha256": "ee870a068162d039f57c1e14b5f157ad976110d6c6538d14aba02c60d43fe4a7" }, "downloads": -1, "filename": "hypopt-1.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6f7a9890f7f9469d0842df59d0a25734", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11558, "upload_time": "2018-10-23T07:13:34", "url": "https://files.pythonhosted.org/packages/7d/3a/28842a7fb0328a2e5c3452c4c885b9c3e15ee991f390cc74d3c932285d06/hypopt-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1115fa023077d8123d14b48c5a9ef0f4", "sha256": "3e962aa7f4c95cedf274348ce2f29f5b8b192fcdb5153fa478de9c9f4e7a69e5" }, "downloads": -1, "filename": "hypopt-1.0.5.tar.gz", "has_sig": false, "md5_digest": "1115fa023077d8123d14b48c5a9ef0f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10226, "upload_time": "2018-10-23T07:13:35", "url": "https://files.pythonhosted.org/packages/93/28/3be3e9e9538ec321fa8e67b779a5c7537ffe52449f1446a84ed8859e29cf/hypopt-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "3626d6677f0b92ac46ed090db5ca5449", "sha256": "20b14ca62ba3d450496aff21e3743212da4cb2de487aedae0a96be210b2a5866" }, "downloads": -1, "filename": "hypopt-1.0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3626d6677f0b92ac46ed090db5ca5449", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11566, "upload_time": "2018-10-23T07:19:39", "url": "https://files.pythonhosted.org/packages/b9/f5/60600bac76f3ec5a3d602f7ece52f237a9918c62c835c7b622ab8b13f31a/hypopt-1.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61a0cd54f36e2dcf61597ad0dc5ad284", "sha256": "98edd1a7f90fb3e3e2636eb5a42b9ddc821c42cfbd16155e60edc7ca335ebfae" }, "downloads": -1, "filename": "hypopt-1.0.6.tar.gz", "has_sig": false, "md5_digest": "61a0cd54f36e2dcf61597ad0dc5ad284", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10207, "upload_time": "2018-10-23T07:19:40", "url": "https://files.pythonhosted.org/packages/fa/06/d68d9e95a0b8ef563fec0addb5cf27deaaa569a43b90292a863582de4f2a/hypopt-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "a99e3d7d3e8b66f8f271f99e2459828b", "sha256": "9b6b4b1aad58ecb876a95492fd467e5338e2293520f8fd4e628650c3a73db68f" }, "downloads": -1, "filename": "hypopt-1.0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a99e3d7d3e8b66f8f271f99e2459828b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11572, "upload_time": "2018-10-25T14:00:09", "url": "https://files.pythonhosted.org/packages/69/fb/ce43d8cdd7ed7cc918eeaee55494ec39b8f0667cd322b6b062af5a581b5e/hypopt-1.0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0eda5d3a043fcd2b69061837415dee5b", "sha256": "1f6d6a07907c59af2e0a24d2034dbb9c788646a3e10e04e80a28105540a61d5b" }, "downloads": -1, "filename": "hypopt-1.0.7.tar.gz", "has_sig": false, "md5_digest": "0eda5d3a043fcd2b69061837415dee5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10220, "upload_time": "2018-10-25T14:00:11", "url": "https://files.pythonhosted.org/packages/f9/e6/286220d1fd8441623b7fd3192f3c6f0fa1722a4fa1de9cfb30556236ae68/hypopt-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "7216815f8479fc3aaaa505a0ef00c417", "sha256": "e58323764962220bbd40acf55186b5937eef47e682cddcb1b1d476b98aa414d5" }, "downloads": -1, "filename": "hypopt-1.0.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7216815f8479fc3aaaa505a0ef00c417", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8451, "upload_time": "2018-12-11T22:50:50", "url": "https://files.pythonhosted.org/packages/ca/9f/e962e2e2fab76bb83550408236feef68b80bd1a53aa58722eb6b9207cf96/hypopt-1.0.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e35d3c00f2d312d7dcbd011fd55b1911", "sha256": "abe126d49cae1a5705ddb90b61ed428138a6453aee604324f53ff6a4ab2e870b" }, "downloads": -1, "filename": "hypopt-1.0.8.tar.gz", "has_sig": false, "md5_digest": "e35d3c00f2d312d7dcbd011fd55b1911", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9138, "upload_time": "2018-12-11T22:50:52", "url": "https://files.pythonhosted.org/packages/62/76/9e50f2afa4b41462d6fe7f2d396afea6a99b34fc0cc326011adc85b292f2/hypopt-1.0.8.tar.gz" } ], "1.0.9": [ { "comment_text": "", "digests": { "md5": "aa1ab29fa04340025549f194375490fa", "sha256": "53bb5fd98d09b634101960778b3c6131a896cb2d6d30792388f56acf01ed7880" }, "downloads": -1, "filename": "hypopt-1.0.9-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "aa1ab29fa04340025549f194375490fa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13075, "upload_time": "2019-07-28T15:34:10", "url": "https://files.pythonhosted.org/packages/6e/8b/17f9022d94066ec29ab0008ed1ad247615153e5c633c2787255cfe2e95b8/hypopt-1.0.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5903ea6d85ae20b66b74619847c4df29", "sha256": "d5ce7032668c7e71f63dcee547dfbc2401931879a0b8b70847f084d68f25933f" }, "downloads": -1, "filename": "hypopt-1.0.9.tar.gz", "has_sig": false, "md5_digest": "5903ea6d85ae20b66b74619847c4df29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11616, "upload_time": "2019-07-28T15:34:12", "url": "https://files.pythonhosted.org/packages/df/dd/1bf09815809af520707455ea2f59d061b427c9da216cfad55c2dcc53f8ad/hypopt-1.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aa1ab29fa04340025549f194375490fa", "sha256": "53bb5fd98d09b634101960778b3c6131a896cb2d6d30792388f56acf01ed7880" }, "downloads": -1, "filename": "hypopt-1.0.9-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "aa1ab29fa04340025549f194375490fa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13075, "upload_time": "2019-07-28T15:34:10", "url": "https://files.pythonhosted.org/packages/6e/8b/17f9022d94066ec29ab0008ed1ad247615153e5c633c2787255cfe2e95b8/hypopt-1.0.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5903ea6d85ae20b66b74619847c4df29", "sha256": "d5ce7032668c7e71f63dcee547dfbc2401931879a0b8b70847f084d68f25933f" }, "downloads": -1, "filename": "hypopt-1.0.9.tar.gz", "has_sig": false, "md5_digest": "5903ea6d85ae20b66b74619847c4df29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11616, "upload_time": "2019-07-28T15:34:12", "url": "https://files.pythonhosted.org/packages/df/dd/1bf09815809af520707455ea2f59d061b427c9da216cfad55c2dcc53f8ad/hypopt-1.0.9.tar.gz" } ] }