|Logo|
|pypi| |conda| |CI Status| |binder| |codecov| |Zenodo DOI|
Scikit-Optimize
===============
Scikit-Optimize, or ``skopt``, is a simple and efficient library for
optimizing (very) expensive and noisy black-box functions. It implements
several methods for sequential model-based optimization. ``skopt`` aims
to be accessible and easy to use in many contexts.
The library is built on top of NumPy, SciPy, and Scikit-Learn.
We do not perform gradient-based optimization. For gradient-based
optimization algorithms look at
``scipy.optimize``
`here <http://docs.scipy.org/doc/scipy/reference/optimize.html>`_.
.. figure:: https://raw.githubusercontent.com/holgern/scikit-optimize/main/media/bo-objective.png
:alt: Approximated objective
Approximated objective function after 50 iterations of ``gp_minimize``.
Plot made using ``skopt.plots.plot_objective``.
Maintaining the codebase
------------------------
This repo is a copy of the original repositoy at https://github.com/scikit-optimize/scikit-optimize/.
As the original repo is now in read-only mode, i decided to continue the development on it on my own.
I still have credentials for pypi, so I will publish new releases at https://pypi.org/project/scikit-optimize/.
I did my best to include all open PR since 2021 in the new release of scikit-optimize 0.10.
https://scikit-optimize.github.io/ has been moved to http://scikit-optimize.readthedocs.io/.
Important links
---------------
- Project website https://scikit-optimize.readthedocs.io/
- Example notebooks - can be found in examples_.
- `Discussion forum
<https://github.com/scikit-optimize/scikit-optimize/discussions>`__
- Issue tracker -
https://github.com/holgern/scikit-optimize/issues
- Releases - https://pypi.python.org/pypi/scikit-optimize
- Conda feedstock - https://github.com/conda-forge/scikit-optimize-feedstock
Install
-------
scikit-optimize requires
* Python >= 3.8
* NumPy (>= 1.20.3)
* SciPy (>= 0.19.1)
* joblib (>= 0.11)
* scikit-learn >= 1.0.0
* matplotlib >= 2.0.0
You can install the latest release with:
::
pip install scikit-optimize
This installs the essentials. To install plotting functionality,
you can instead do:
::
pip install 'scikit-optimize[plots]'
This will additionally install Matplotlib.
If you're using Anaconda platform, there is a `conda-forge <https://conda-forge.org/>`_
package of scikit-optimize:
::
conda install -c conda-forge scikit-optimize
Using conda-forge is probably the easiest way to install scikit-optimize on
Windows.
Getting started
---------------
Find the minimum of the noisy function ``f(x)`` over the range
``-2 < x < 2`` with ``skopt``:
.. code:: python
import numpy as np
from skopt import gp_minimize
def f(x):
return (np.sin(5 * x[0]) * (1 - np.tanh(x[0] ** 2)) +
np.random.randn() * 0.1)
res = gp_minimize(f, [(-2.0, 2.0)])
For more control over the optimization loop you can use the ``skopt.Optimizer``
class:
.. code:: python
from skopt import Optimizer
opt = Optimizer([(-2.0, 2.0)])
for i in range(20):
suggested = opt.ask()
y = f(suggested)
opt.tell(suggested, y)
print('iteration:', i, suggested, y)
Read our `introduction to bayesian
optimization <https://scikit-optimize.readthedocs.io/en/latest/auto_examples/bayesian-optimization.html>`__
and the other examples_.
Development
-----------
The library is still experimental and under development. Checkout
the `next
milestone <https://github.com/holgern/scikit-optimize/milestones>`__
for the plans for the next release or look at some `easy
issues <https://github.com/holgern/scikit-optimize/issues?q=is%3Aissue+is%3Aopen+label%3AEasy>`__
to get started contributing.
The development version can be installed through:
::
git clone https://github.com/holgern/scikit-optimize.git
cd scikit-optimize
pip install -e .
Run all tests by executing ``pytest`` in the top level directory.
To only run the subset of tests with short run time, you can use ``pytest -m 'fast_test'`` (``pytest -m 'slow_test'`` is also possible). To exclude all slow running tests try ``pytest -m 'not slow_test'``.
This is implemented using pytest `attributes <https://docs.pytest.org/en/latest/mark.html>`__. If a tests runs longer than 1 second, it is marked as slow, else as fast.
All contributors are welcome!
Pre-commit-config
-----------------
Installation
~~~~~~~~~~~~
::
pip install pre-commit
Using homebrew
~~~~~~~~~~~~~~
::
brew install pre-commit
pre-commit --version
pre-commit 2.10.0
Install the git hook scripts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
pre-commit install
Run against all the files
~~~~~~~~~~~~~~~~~~~~~~~~~
::
pre-commit run --all-files
pre-commit run --show-diff-on-failure --color=always --all-files
Update package rev in pre-commit yaml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
pre-commit autoupdate
pre-commit run --show-diff-on-failure --color=always --all-files
Making a Release
~~~~~~~~~~~~~~~~
The release procedure is almost completely automated. By tagging a new release,
CI will build all required packages and push them to PyPI. To make a release,
create a new issue and work through the following checklist:
* [ ] check if the dependencies in `setup.py` are valid or need unpinning,
* [ ] check that the `doc/whats_new/v0.X.rst` is up-to-date,
* [ ] did the last build of master succeed?
* [ ] create a [new release](https://github.com/holgern/scikit-optimize/releases),
* [ ] ping [conda-forge](https://github.com/conda-forge/scikit-optimize-feedstock).
Before making a release, we usually create a release candidate. If the next
release is v0.X, then the release candidate should be tagged v0.Xrc1.
Mark the release candidate as a "pre-release" on GitHub when you tag it.
Made possible by
----------------
The scikit-optimize project was made possible with the support of
.. image:: https://avatars1.githubusercontent.com/u/18165687?v=4&s=128
:alt: Wild Tree Tech
:target: https://wildtreetech.com
.. image:: https://i.imgur.com/lgxboT5.jpg
:alt: NYU Center for Data Science
:target: https://cds.nyu.edu/
.. image:: https://i.imgur.com/V1VSIvj.jpg
:alt: NSF
:target: https://www.nsf.gov
.. image:: https://i.imgur.com/3enQ6S8.jpg
:alt: Northrop Grumman
:target: https://www.northropgrumman.com/Pages/default.aspx
If your employer allows you to work on scikit-optimize during the day and would like
recognition, feel free to add them to the "Made possible by" list.
.. |pypi| image:: https://img.shields.io/pypi/v/scikit-optimize.svg
:target: https://pypi.python.org/pypi/scikit-optimize
.. |conda| image:: https://anaconda.org/conda-forge/scikit-optimize/badges/version.svg
:target: https://anaconda.org/conda-forge/scikit-optimize
.. |CI Status| image:: https://github.com/holgern/scikit-optimize/actions/workflows/ci.yml/badge.svg?branch=main
:target: https://github.com/holgern/scikit-optimize/actions/workflows/ci.yml?query=branch%3Amain
.. |Logo| image:: https://avatars2.githubusercontent.com/u/18578550?v=4&s=80
.. |binder| image:: https://mybinder.org/badge.svg
:target: https://mybinder.org/v2/gh/holgern/scikit-optimize/main?filepath=examples
.. |Zenodo DOI| image:: https://zenodo.org/badge/768077165.svg
:target: https://zenodo.org/doi/10.5281/zenodo.10804382
.. |scipy.optimize| replace:: ``scipy.optimize``
.. _scipy.optimize: https://docs.scipy.org/doc/scipy/reference/optimize.html
.. _examples: https://scikit-optimize.readthedocs.io/en/latest/auto_examples/index.html
.. |codecov| image:: https://codecov.io/gh/holgern/scikit-optimize/graph/badge.svg?token=9Mp32drAPj
:target: https://codecov.io/gh/holgern/scikit-optimize
Raw data
{
"_id": null,
"home_page": null,
"name": "scikit-optimize",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "The scikit-optimize contributors",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b3/95/1b433b9eb9eb653fb97fd525552fd027886e3812d7d20d843994263340aa/scikit_optimize-0.10.2.tar.gz",
"platform": null,
"description": "\n|Logo|\n\n|pypi| |conda| |CI Status| |binder| |codecov| |Zenodo DOI|\n\nScikit-Optimize\n===============\n\nScikit-Optimize, or ``skopt``, is a simple and efficient library for\noptimizing (very) expensive and noisy black-box functions. It implements\nseveral methods for sequential model-based optimization. ``skopt`` aims\nto be accessible and easy to use in many contexts.\n\nThe library is built on top of NumPy, SciPy, and Scikit-Learn.\n\nWe do not perform gradient-based optimization. For gradient-based\noptimization algorithms look at\n``scipy.optimize``\n`here <http://docs.scipy.org/doc/scipy/reference/optimize.html>`_.\n\n.. figure:: https://raw.githubusercontent.com/holgern/scikit-optimize/main/media/bo-objective.png\n :alt: Approximated objective\n\nApproximated objective function after 50 iterations of ``gp_minimize``.\nPlot made using ``skopt.plots.plot_objective``.\n\nMaintaining the codebase\n------------------------\nThis repo is a copy of the original repositoy at https://github.com/scikit-optimize/scikit-optimize/.\nAs the original repo is now in read-only mode, i decided to continue the development on it on my own.\nI still have credentials for pypi, so I will publish new releases at https://pypi.org/project/scikit-optimize/.\nI did my best to include all open PR since 2021 in the new release of scikit-optimize 0.10.\n\nhttps://scikit-optimize.github.io/ has been moved to http://scikit-optimize.readthedocs.io/.\n\nImportant links\n---------------\n\n- Project website https://scikit-optimize.readthedocs.io/\n- Example notebooks - can be found in examples_.\n- `Discussion forum\n <https://github.com/scikit-optimize/scikit-optimize/discussions>`__\n- Issue tracker -\n https://github.com/holgern/scikit-optimize/issues\n- Releases - https://pypi.python.org/pypi/scikit-optimize\n- Conda feedstock - https://github.com/conda-forge/scikit-optimize-feedstock\n\nInstall\n-------\n\nscikit-optimize requires\n\n* Python >= 3.8\n* NumPy (>= 1.20.3)\n* SciPy (>= 0.19.1)\n* joblib (>= 0.11)\n* scikit-learn >= 1.0.0\n* matplotlib >= 2.0.0\n\nYou can install the latest release with:\n::\n\n pip install scikit-optimize\n\nThis installs the essentials. To install plotting functionality,\nyou can instead do:\n::\n\n pip install 'scikit-optimize[plots]'\n\nThis will additionally install Matplotlib.\n\nIf you're using Anaconda platform, there is a `conda-forge <https://conda-forge.org/>`_\npackage of scikit-optimize:\n::\n\n conda install -c conda-forge scikit-optimize\n\nUsing conda-forge is probably the easiest way to install scikit-optimize on\nWindows.\n\n\nGetting started\n---------------\n\nFind the minimum of the noisy function ``f(x)`` over the range\n``-2 < x < 2`` with ``skopt``:\n\n.. code:: python\n\n import numpy as np\n from skopt import gp_minimize\n\n def f(x):\n return (np.sin(5 * x[0]) * (1 - np.tanh(x[0] ** 2)) +\n np.random.randn() * 0.1)\n\n res = gp_minimize(f, [(-2.0, 2.0)])\n\n\nFor more control over the optimization loop you can use the ``skopt.Optimizer``\nclass:\n\n.. code:: python\n\n from skopt import Optimizer\n\n opt = Optimizer([(-2.0, 2.0)])\n\n for i in range(20):\n suggested = opt.ask()\n y = f(suggested)\n opt.tell(suggested, y)\n print('iteration:', i, suggested, y)\n\n\nRead our `introduction to bayesian\noptimization <https://scikit-optimize.readthedocs.io/en/latest/auto_examples/bayesian-optimization.html>`__\nand the other examples_.\n\n\nDevelopment\n-----------\n\nThe library is still experimental and under development. Checkout\nthe `next\nmilestone <https://github.com/holgern/scikit-optimize/milestones>`__\nfor the plans for the next release or look at some `easy\nissues <https://github.com/holgern/scikit-optimize/issues?q=is%3Aissue+is%3Aopen+label%3AEasy>`__\nto get started contributing.\n\nThe development version can be installed through:\n\n::\n\n git clone https://github.com/holgern/scikit-optimize.git\n cd scikit-optimize\n pip install -e .\n\nRun all tests by executing ``pytest`` in the top level directory.\n\nTo only run the subset of tests with short run time, you can use ``pytest -m 'fast_test'`` (``pytest -m 'slow_test'`` is also possible). To exclude all slow running tests try ``pytest -m 'not slow_test'``.\n\nThis is implemented using pytest `attributes <https://docs.pytest.org/en/latest/mark.html>`__. If a tests runs longer than 1 second, it is marked as slow, else as fast.\n\nAll contributors are welcome!\n\n\n\nPre-commit-config\n-----------------\n\nInstallation\n~~~~~~~~~~~~\n\n::\n\n pip install pre-commit\n\n\nUsing homebrew\n~~~~~~~~~~~~~~\n::\n\n brew install pre-commit\n\n pre-commit --version\n pre-commit 2.10.0\n\nInstall the git hook scripts\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n pre-commit install\n\n\nRun against all the files\n~~~~~~~~~~~~~~~~~~~~~~~~~\n::\n\n pre-commit run --all-files\n pre-commit run --show-diff-on-failure --color=always --all-files\n\n\nUpdate package rev in pre-commit yaml\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n::\n\n pre-commit autoupdate\n pre-commit run --show-diff-on-failure --color=always --all-files\n\n\nMaking a Release\n~~~~~~~~~~~~~~~~\n\nThe release procedure is almost completely automated. By tagging a new release,\nCI will build all required packages and push them to PyPI. To make a release,\ncreate a new issue and work through the following checklist:\n\n* [ ] check if the dependencies in `setup.py` are valid or need unpinning,\n* [ ] check that the `doc/whats_new/v0.X.rst` is up-to-date,\n* [ ] did the last build of master succeed?\n* [ ] create a [new release](https://github.com/holgern/scikit-optimize/releases),\n* [ ] ping [conda-forge](https://github.com/conda-forge/scikit-optimize-feedstock).\n\nBefore making a release, we usually create a release candidate. If the next\nrelease is v0.X, then the release candidate should be tagged v0.Xrc1.\nMark the release candidate as a \"pre-release\" on GitHub when you tag it.\n\nMade possible by\n----------------\n\nThe scikit-optimize project was made possible with the support of\n\n.. image:: https://avatars1.githubusercontent.com/u/18165687?v=4&s=128\n :alt: Wild Tree Tech\n :target: https://wildtreetech.com\n\n.. image:: https://i.imgur.com/lgxboT5.jpg\n :alt: NYU Center for Data Science\n :target: https://cds.nyu.edu/\n\n.. image:: https://i.imgur.com/V1VSIvj.jpg\n :alt: NSF\n :target: https://www.nsf.gov\n\n.. image:: https://i.imgur.com/3enQ6S8.jpg\n :alt: Northrop Grumman\n :target: https://www.northropgrumman.com/Pages/default.aspx\n\nIf your employer allows you to work on scikit-optimize during the day and would like\nrecognition, feel free to add them to the \"Made possible by\" list.\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/scikit-optimize.svg\n :target: https://pypi.python.org/pypi/scikit-optimize\n.. |conda| image:: https://anaconda.org/conda-forge/scikit-optimize/badges/version.svg\n :target: https://anaconda.org/conda-forge/scikit-optimize\n.. |CI Status| image:: https://github.com/holgern/scikit-optimize/actions/workflows/ci.yml/badge.svg?branch=main\n :target: https://github.com/holgern/scikit-optimize/actions/workflows/ci.yml?query=branch%3Amain\n.. |Logo| image:: https://avatars2.githubusercontent.com/u/18578550?v=4&s=80\n.. |binder| image:: https://mybinder.org/badge.svg\n :target: https://mybinder.org/v2/gh/holgern/scikit-optimize/main?filepath=examples\n.. |Zenodo DOI| image:: https://zenodo.org/badge/768077165.svg\n :target: https://zenodo.org/doi/10.5281/zenodo.10804382\n.. |scipy.optimize| replace:: ``scipy.optimize``\n.. _scipy.optimize: https://docs.scipy.org/doc/scipy/reference/optimize.html\n.. _examples: https://scikit-optimize.readthedocs.io/en/latest/auto_examples/index.html\n.. |codecov| image:: https://codecov.io/gh/holgern/scikit-optimize/graph/badge.svg?token=9Mp32drAPj\n :target: https://codecov.io/gh/holgern/scikit-optimize\n",
"bugtrack_url": null,
"license": "BSD 3-clause",
"summary": "Sequential model-based optimization toolbox.",
"version": "0.10.2",
"project_urls": {
"Bug Tracker": "https://github.com/holgern/scikit-optimize/issues",
"Homepage": "https://scikit-optimize.readthedocs.io/en/latest/contents.html",
"Source Code": "https://github.com/holgern/scikit-optimize"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "65cd15c9ebea645cc9860aa71fe0474f4be981f10ed8e19e1fb0ef1027d4966e",
"md5": "421085da4a979e4fec5e8990c86f0450",
"sha256": "45bc7e879b086133984721f2f6735a86c085073f6c481c2ec665b5c67b44d723"
},
"downloads": -1,
"filename": "scikit_optimize-0.10.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "421085da4a979e4fec5e8990c86f0450",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 107794,
"upload_time": "2024-06-04T19:12:54",
"upload_time_iso_8601": "2024-06-04T19:12:54.592302Z",
"url": "https://files.pythonhosted.org/packages/65/cd/15c9ebea645cc9860aa71fe0474f4be981f10ed8e19e1fb0ef1027d4966e/scikit_optimize-0.10.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b3951b433b9eb9eb653fb97fd525552fd027886e3812d7d20d843994263340aa",
"md5": "b1f0f2000b6a98b3365f0ffa4547627f",
"sha256": "00a3d91bf9015e292b6e7aaefe7e6cb95e8d25ce19adafd2cd88849e1a0b0da0"
},
"downloads": -1,
"filename": "scikit_optimize-0.10.2.tar.gz",
"has_sig": false,
"md5_digest": "b1f0f2000b6a98b3365f0ffa4547627f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 86202,
"upload_time": "2024-06-04T19:12:56",
"upload_time_iso_8601": "2024-06-04T19:12:56.879458Z",
"url": "https://files.pythonhosted.org/packages/b3/95/1b433b9eb9eb653fb97fd525552fd027886e3812d7d20d843994263340aa/scikit_optimize-0.10.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-04 19:12:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "holgern",
"github_project": "scikit-optimize",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "scikit-optimize"
}