Skip to content

Commit 2458394

Browse files
committed
Convert README to Markdown
1 parent 23a4ab0 commit 2458394

File tree

3 files changed

+223
-201
lines changed

3 files changed

+223
-201
lines changed

README.md

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
substitutions:
3+
Binder: |-
4+
```{image} https://mybinder.org/badge.svg
5+
:target: https://mybinder.org/v2/gh/python-adaptive/adaptive/master?filepath=example-notebook.ipynb
6+
```
7+
Conda: |-
8+
```{image} https://img.shields.io/badge/install%20with-conda-green.svg
9+
:target: https://anaconda.org/conda-forge/adaptive
10+
```
11+
Coverage: |-
12+
```{image} https://img.shields.io/codecov/c/github/python-adaptive/adaptive
13+
:target: https://codecov.io/gh/python-adaptive/adaptive
14+
```
15+
DOI: |-
16+
```{image} https://img.shields.io/badge/doi-10.5281%2Fzenodo.1182437-blue.svg
17+
:target: https://doi.org/10.5281/zenodo.1182437
18+
```
19+
Documentation: |-
20+
```{image} https://readthedocs.org/projects/adaptive/badge/?version=latest
21+
:target: https://adaptive.readthedocs.io/en/latest/?badge=latest
22+
```
23+
Downloads: |-
24+
```{image} https://img.shields.io/conda/dn/conda-forge/adaptive.svg
25+
:target: https://anaconda.org/conda-forge/adaptive
26+
```
27+
GitHub: |-
28+
```{image} https://img.shields.io/github/stars/python-adaptive/adaptive.svg?style=social
29+
:target: https://github.com/python-adaptive/adaptive/stargazers
30+
```
31+
Gitter: |-
32+
```{image} https://img.shields.io/gitter/room/nwjs/nw.js.svg
33+
:target: https://gitter.im/python-adaptive/adaptive
34+
```
35+
Pipeline status: |-
36+
```{image} https://dev.azure.com/python-adaptive/adaptive/_apis/build/status/python-adaptive.adaptive?branchName=master
37+
:target: https://dev.azure.com/python-adaptive/adaptive/_build/latest?definitionId=6?branchName=master
38+
```
39+
PyPI: |-
40+
```{image} https://img.shields.io/pypi/v/adaptive.svg
41+
:target: https://pypi.python.org/pypi/adaptive
42+
```
43+
logo: |-
44+
```{image} https://adaptive.readthedocs.io/en/latest/_static/logo.png
45+
```
46+
---
47+
48+
% summary-start
49+
50+
# {{ logo }} adaptive
51+
52+
{{ PyPI }} {{ Conda }} {{ Downloads }} {{ Pipeline status }} {{ DOI }} {{ Binder }} {{ Gitter }}
53+
{{ Documentation }} {{ Coverage }} {{ GitHub }}
54+
55+
> *Adaptive*: parallel active learning of mathematical functions.
56+
57+
```{eval-rst}
58+
.. include:: logo.rst
59+
```
60+
61+
`adaptive` is an open-source Python library designed to make adaptive parallel function evaluation simple. With `adaptive` you just supply a function with its bounds, and it will be evaluated at the “best” points in parameter space, rather than unnecessarily computing *all* points on a dense grid.
62+
With just a few lines of code you can evaluate functions on a computing cluster, live-plot the data as it returns, and fine-tune the adaptive sampling algorithm.
63+
64+
`adaptive` shines on computations where each evaluation of the function takes *at least* ≈100ms due to the overhead of picking potentially interesting points.
65+
66+
Run the `adaptive` example notebook [live on Binder](https://mybinder.org/v2/gh/python-adaptive/adaptive/master?filepath=example-notebook.ipynb) to see examples of how to use `adaptive` or visit the [tutorial on Read the Docs](https://adaptive.readthedocs.io/en/latest/tutorial/tutorial.html).
67+
68+
% summary-end
69+
70+
## Implemented algorithms
71+
72+
The core concept in `adaptive` is that of a *learner*.
73+
A *learner* samples a function at the best places in its parameter space to get maximum “information” about the function.
74+
As it evaluates the function at more and more points in the parameter space, it gets a better idea of where the best places are to sample next.
75+
76+
Of course, what qualifies as the “best places” will depend on your application domain! `adaptive` makes some reasonable default choices, but the details of the adaptive sampling are completely customizable.
77+
78+
The following learners are implemented:
79+
80+
% not-in-documentation-start
81+
82+
- `Learner1D`, for 1D functions `f: ℝ → ℝ^N`,
83+
- `Learner2D`, for 2D functions `f: ℝ^2 → ℝ^N`,
84+
- `LearnerND`, for ND functions `f: ℝ^N → ℝ^M`,
85+
- `AverageLearner`, for random variables where you want to average the result over many evaluations,
86+
- `AverageLearner1D`, for stochastic 1D functions where you want to estimate the mean value of the function at each point,
87+
- `IntegratorLearner`, for when you want to intergrate a 1D function `f: ℝ → ℝ`.
88+
- `BalancingLearner`, for when you want to run several learners at once, selecting the “best” one each time you get more points.
89+
90+
Meta-learners (to be used with other learners):
91+
92+
- `BalancingLearner`, for when you want to run several learners at once, selecting the “best” one each time you get more points,
93+
- `DataSaver`, for when your function doesn't just return a scalar or a vector.
94+
95+
In addition to the learners, `adaptive` also provides primitives for running the sampling across several cores and even several machines, with built-in support for
96+
[concurrent.futures](https://docs.python.org/3/library/concurrent.futures.html),
97+
[mpi4py](https://mpi4py.readthedocs.io/en/stable/mpi4py.futures.html),
98+
[loky](https://loky.readthedocs.io/en/stable/),
99+
[ipyparallel](https://ipyparallel.readthedocs.io/en/latest/) and
100+
[distributed](https://distributed.readthedocs.io/en/latest/).
101+
102+
## Examples
103+
104+
Adaptively learning a 1D function (the `gif` below) and live-plotting the process in a Jupyter notebook is as easy as
105+
106+
```python
107+
from adaptive import notebook_extension, Runner, Learner1D
108+
109+
notebook_extension()
110+
111+
112+
def peak(x, a=0.01):
113+
return x + a**2 / (a**2 + x**2)
114+
115+
116+
learner = Learner1D(peak, bounds=(-1, 1))
117+
runner = Runner(learner, goal=lambda l: l.loss() < 0.01)
118+
runner.live_info()
119+
runner.live_plot()
120+
```
121+
122+
```{raw} html
123+
<img src="https://user-images.githubusercontent.com/6897215/38739170-6ac7c014-3f34-11e8-9e8f-93b3a3a3d61b.gif" width='20%'> </img> <img src="https://user-images.githubusercontent.com/6897215/35219611-ac8b2122-ff73-11e7-9332-adffab64a8ce.gif" width='40%'> </img> <img src="https://user-images.githubusercontent.com/6897215/47256441-d6d53700-d480-11e8-8224-d1cc49dbdcf5.gif" width='20%'> </img>
124+
```
125+
126+
% not-in-documentation-end
127+
128+
## Installation
129+
130+
`adaptive` works with Python 3.7 and higher on Linux, Windows, or Mac, and provides optional extensions for working with the Jupyter/IPython Notebook.
131+
132+
The recommended way to install adaptive is using `conda`:
133+
134+
```bash
135+
conda install -c conda-forge adaptive
136+
```
137+
138+
`adaptive` is also available on PyPI:
139+
140+
```bash
141+
pip install "adaptive[notebook]"
142+
```
143+
144+
The `[notebook]` above will also install the optional dependencies for running `adaptive` inside a Jupyter notebook.
145+
146+
To use Adaptive in Jupyterlab, you need to install the following labextensions.
147+
148+
```bash
149+
jupyter labextension install @jupyter-widgets/jupyterlab-manager
150+
jupyter labextension install @pyviz/jupyterlab_pyviz
151+
```
152+
153+
## Development
154+
155+
Clone the repository and run `pip install -e ".[notebook,testing,other]"` to add a link to the cloned repo into your Python path:
156+
157+
```bash
158+
git clone [email protected]:python-adaptive/adaptive.git
159+
cd adaptive
160+
pip install -e ".[notebook,testing,other]"
161+
```
162+
163+
We highly recommend using a Conda environment or a virtualenv to manage the versions of your installed packages while working on `adaptive`.
164+
165+
In order to not pollute the history with the output of the notebooks, please setup the git filter by executing
166+
167+
```bash
168+
python ipynb_filter.py
169+
```
170+
171+
in the repository.
172+
173+
We implement several other checks in order to maintain a consistent code style. We do this using [pre-commit](https://pre-commit.com), execute
174+
175+
```bash
176+
pre-commit install
177+
```
178+
179+
in the repository.
180+
181+
## Citing
182+
183+
If you used Adaptive in a scientific work, please cite it as follows.
184+
185+
```bib
186+
@misc{Nijholt2019,
187+
doi = {10.5281/zenodo.1182437},
188+
author = {Bas Nijholt and Joseph Weston and Jorn Hoofwijk and Anton Akhmerov},
189+
title = {\textit{Adaptive}: parallel active learning of mathematical functions},
190+
publisher = {Zenodo},
191+
year = {2019}
192+
}
193+
```
194+
195+
## Credits
196+
197+
We would like to give credits to the following people:
198+
199+
- Pedro Gonnet for his implementation of [CQUAD](https://www.gnu.org/software/gsl/manual/html_node/CQUAD-doubly_002dadaptive-integration.html),
200+
“Algorithm 4” as described in “Increasing the Reliability of Adaptive
201+
Quadrature Using Explicit Interpolants”, P. Gonnet, ACM Transactions on
202+
Mathematical Software, 37 (3), art. no. 26, 2010.
203+
- Pauli Virtanen for his `AdaptiveTriSampling` script (no longer
204+
available online since SciPy Central went down) which served as
205+
inspiration for the `~adaptive.Learner2D`.
206+
207+
% credits-end
208+
209+
For general discussion, we have a [Gitter chat channel](https://gitter.im/python-adaptive/adaptive). If you find any bugs or have any feature suggestions please file a GitHub [issue](https://github.com/python-adaptive/adaptive/issues/new) or submit a [pull request](https://github.com/python-adaptive/adaptive/pulls).
210+
211+
% references-start
212+
213+
% references-end

0 commit comments

Comments
 (0)