|||
refer to : https://github.com/python-adaptive/adaptive
Examples
Adaptively learning a 1D function (the gif below) and live-plotting the process in a Jupyter notebook is as easy as
from adaptive import notebook_extension, Runner, Learner1Dnotebook_extension()def peak(x, a=0.01): return x + a**2 / (a**2 + x**2)learner = Learner1D(peak, bounds=(-1, 1))runner = Runner(learner, goal=lambda l: l.loss() < 0.01)runner.live_info()runner.live_plot()
adaptive
works with Python 3.6 and higher on Linux, Windows, or Mac,
and provides optional extensions for working with the Jupyter/IPython
Notebook.
The recommended way to install adaptive is using conda
:
conda install -c conda-forge adaptive
adaptive
is also available on PyPI:
pip install adaptive[notebook]
The [notebook]
above will also install the optional dependencies for
running adaptive
inside a Jupyter notebook.
To use Adaptive in Jupyterlab, you need to install the following labextensions.
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter labextension install @pyviz/jupyterlab_pyviz
Clone the repository and run setup.py develop
to add a link to the
cloned repo into your Python path:
git clone git@github.com:python-adaptive/adaptive.gitcd adaptive python3 setup.py develop
We highly recommend using a Conda environment or a virtualenv to manage
the versions of your installed packages while working on adaptive
.
In order to not pollute the history with the output of the notebooks, please setup the git filter by executing
python ipynb_filter.py
in the repository.
We implement several other checks in order to maintain a consistent code style. We do this using pre-commit, execute
pre-commit install
in the repository.
If you used Adaptive in a scientific work, please cite it as follows.
@misc{Nijholt2019, doi = {10.5281/zenodo.1182437}, author = {Bas Nijholt and Joseph Weston and Jorn Hoofwijk and Anton Akhmerov}, title = {\textit{Adaptive}: parallel active learning of mathematical functions}, publisher = {Zenodo}, year = {2019}}
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-27 14:52
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社