zsh2270365028的个人博客分享 http://blog.sciencenet.cn/u/zsh2270365028

博文

[转载]adaptively learning

已有 1447 次阅读 2020-9-7 16:37 |个人分类:Python|系统分类:科研笔记|文章来源:转载

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()

Installation

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

Development

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.

Citing

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}}




https://blog.sciencenet.cn/blog-587102-1249624.html

上一篇:python install multiprocess
下一篇:python记录程序运行时间的三种方法
收藏 IP: 119.78.226.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-27 14:52

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部