You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 61ed359
Browse filesBrowse the repository at this point in the historyBrowse files
Adaptive is an open-source Python library that streamlines adaptive parallel function evaluations.
20
20
Rather than calculating all points on a dense grid, it intelligently selects the "best" points in the parameter space based on your provided function and bounds.
21
21
With minimal code, you can perform evaluations on a computing cluster, display live plots, and optimize the adaptive sampling algorithm.
22
22
23
23
Adaptive is most efficient for computations where each function evaluation takes at least ≈50ms due to the overhead of selecting potentially interesting points.
24
24
25
-
To see Adaptive in action, try the [example notebook on Binder](https://mybinder.org/v2/gh/python-adaptive/adaptive/main?filepath=example-notebook.ipynb) or explore the [tutorial on Read the Docs](https://adaptive.readthedocs.io/en/latest/tutorial/tutorial).
25
+
To see Adaptive in action, try the [example notebook on Binder](https://mybinder.org/v2/gh/python-adaptive/adaptive/main?filepath=example-notebook.ipynb) or explore the [tutorial on Read the Docs](https://adaptive.readthedocs.io/en/latest/tutorial/tutorial/).
26
26
27
-
<!--summary-end -->
27
+
<!----8<-- [end:summary]-->
28
28
29
-
<details><summary><b><u>[ToC]</u></b> 📚</summary>
29
+
<details><summary><b>Table of contents</b></summary>
30
30
31
31
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
32
32
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -38,6 +38,7 @@ To see Adaptive in action, try the [example notebook on Binder](https://mybinder
@@ -46,20 +47,20 @@ To see Adaptive in action, try the [example notebook on Binder](https://mybinder
46
47
47
48
</details>
48
49
49
-
<!--key-features-start -->
50
+
<!----8<-- [start:key-features]-->
50
51
51
52
## Key features
52
53
53
-
-🎯 **Intelligent Adaptive Sampling**: Adaptive focuses on areas of interest within a function, ensuring better results with fewer evaluations, saving time, and computational resources.
54
-
-⚡ **Parallel Execution**: The library leverages parallel processing for faster function evaluations, making optimal use of available computational resources.
55
-
-📊 **Live Plotting and Info Widgets**: When working in Jupyter notebooks, Adaptive offers real-time visualization of the learning process, making it easier to monitor progress and identify areas of improvement.
56
-
-🔧 **Customizable Loss Functions**: Adaptive supports various loss functions and allows customization, enabling users to tailor the learning process according to their specific needs.
57
-
-📈 **Support for Multidimensional Functions**: The library can handle functions with scalar or vector outputs in one or multiple dimensions, providing flexibility for a wide range of problems.
58
-
-🧩 **Seamless Integration**: Adaptive offers a simple and intuitive interface, making it easy to integrate with existing Python projects and workflows.
59
-
-💾 **Flexible Data Export**: The library provides options to export learned data as NumPy arrays or Pandas DataFrames, ensuring compatibility with various data processing tools.
60
-
-🌐 **Open-Source and Community-Driven**: Adaptive is an open-source project, encouraging contributions from the community to continuously improve and expand the library's features and capabilities.
54
+
-**Intelligent Adaptive Sampling**: Adaptive focuses on areas of interest within a function, ensuring better results with fewer evaluations, saving time, and computational resources.
55
+
-**Parallel Execution**: The library leverages parallel processing for faster function evaluations, making optimal use of available computational resources.
56
+
-**Live Plotting and Info Widgets**: When working in Jupyter notebooks, Adaptive offers real-time visualization of the learning process, making it easier to monitor progress and identify areas of improvement.
57
+
-**Customizable Loss Functions**: Adaptive supports various loss functions and allows customization, enabling users to tailor the learning process according to their specific needs.
58
+
-**Support for Multidimensional Functions**: The library can handle functions with scalar or vector outputs in one or multiple dimensions, providing flexibility for a wide range of problems.
59
+
-**Seamless Integration**: Adaptive offers a simple and intuitive interface, making it easy to integrate with existing Python projects and workflows.
60
+
-**Flexible Data Export**: The library provides options to export learned data as NumPy arrays or Pandas DataFrames, ensuring compatibility with various data processing tools.
61
+
-**Open-Source and Community-Driven**: Adaptive is an open-source project, encouraging contributions from the community to continuously improve and expand the library's features and capabilities.
With the same number of points, adaptive sampling resolves features that a homogeneous grid misses:
86
+
87
+
<palign="center">
88
+
<imgsrc="https://raw.githubusercontent.com/python-adaptive/adaptive/main/docs/_static/readme/learner1d.gif"width="43%"alt="Learner1D: homogeneous grid versus adaptive sampling of a sharp peak">
89
+
<imgsrc="https://raw.githubusercontent.com/python-adaptive/adaptive/main/docs/_static/readme/learner2d.gif"width="36%"alt="Learner2D: homogeneous grid versus adaptive triangulation of a ring">
90
+
<imgsrc="https://raw.githubusercontent.com/python-adaptive/adaptive/main/docs/_static/readme/learnerND.gif"width="19%"alt="LearnerND: sampled points concentrate on a spherical shell">
91
+
</p>
85
92
86
93
### Exporting Data
87
94
@@ -97,7 +104,7 @@ If you have Pandas installed, you can also export the data as a DataFrame:
97
104
df = learner.to_dataframe()
98
105
```
99
106
100
-
<!--implemented-algorithms-start -->
107
+
<!----8<-- [start:implemented-algorithms]-->
101
108
102
109
## Implemented Algorithms
103
110
@@ -110,15 +117,15 @@ While `adaptive` provides sensible default choices, the adaptive sampling proces
110
117
111
118
The following learners are implemented:
112
119
113
-
<!--implemented-algorithms-end -->
120
+
<!----8<-- [end:implemented-algorithms]-->
114
121
115
122
-`Learner1D`: for 1D functions `f: ℝ → ℝ^N`,
116
123
-`Learner2D`: for 2D functions `f: ℝ^2 → ℝ^N`,
117
124
-`LearnerND`: for ND functions `f: ℝ^N → ℝ^M`,
118
125
-`AverageLearner`: for random variables, allowing averaging of results over multiple evaluations,
119
126
-`AverageLearner1D`: for stochastic 1D functions, estimating the mean value at each point,
120
127
-`IntegratorLearner`: for integrating a 1D function `f: ℝ → ℝ`,
121
-
-`BalancingLearner`: for running multiple learners simultaneously and selecting the "best" one as more points are gathered.
128
+
-`SequenceLearner`: for evaluating a fixed sequence of points while still using the runners, parallelism, and data export of Adaptive.
122
129
123
130
Meta-learners (to be used with other learners):
124
131
@@ -132,11 +139,11 @@ In addition to learners, `adaptive` offers primitives for parallel sampling acro
132
139
[ipyparallel](https://ipyparallel.readthedocs.io/en/latest/), and
The `[notebook]` above will also install the optional dependencies for running `adaptive` inside a Jupyter notebook.
160
+
The `[notebook]` above also installs the optional dependencies for live plotting and widgets in JupyterLab and Jupyter Notebook; no extra Jupyter extensions need to be installed.
No code changes are needed — the Rust backend is detected and used automatically.
164
171
To control the selection, pass `LearnerND(..., triangulation_backend="python" | "rust" | "auto")` per learner, or set the environment variable `ADAPTIVE_TRIANGULATION_BACKEND=python` to force the pure-Python implementation globally (or to `rust` to make a missing Rust backend an error instead of a silent fallback).
165
172
166
-
To use Adaptive in Jupyterlab, you need to install the following labextensions.
We recommend using a Conda environment or a virtualenv for package management during Adaptive development.
183
+
We recommend a virtual environment, for example with [uv](https://docs.astral.sh/uv/) (`uv sync --extra notebook --extra test --extra other`) or Conda.
184
184
185
185
To avoid polluting the history with notebook output, set up the git filter by running:
186
186
@@ -198,6 +198,19 @@ pre-commit install
198
198
199
199
in the repository.
200
200
201
+
### Documentation
202
+
203
+
The documentation is built with [Zensical](https://zensical.org).
204
+
The executable pages in `docs/notebooks/` are Jupyter notebooks in [jupytext's MyST Markdown format](https://jupytext.readthedocs.io/en/latest/formats-markdown.html).
205
+
`docs/build_notebooks.py` executes them (with caching) and renders them into `docs/`, after which Zensical builds the site:
206
+
207
+
```bash
208
+
uv run --group docs python docs/build_notebooks.py
209
+
uv run --group docs zensical serve # preview on http://localhost:8000
210
+
```
211
+
212
+
The animations in this README are rendered from real learner runs with `uv run --group docs python docs/make_animations.py` (requires `ffmpeg` and Chrome or Chromium).
213
+
201
214
## Citing
202
215
203
216
If you used Adaptive in a scientific work, please cite it as follows.
@@ -224,7 +237,10 @@ We would like to give credits to the following people:
224
237
- Pedro Gonnet for his implementation of [CQUAD](https://www.gnu.org/software/gsl/manual/html_node/CQUAD-doubly_002dadaptive-integration.html), “Algorithm 4” as described in “Increasing the Reliability of Adaptive Quadrature Using Explicit Interpolants”, P. Gonnet, ACM Transactions on Mathematical Software, 37 (3), art. no. 26, 2010.
225
238
- Pauli Virtanen for his `AdaptiveTriSampling` script (no longer available online since SciPy Central went down) which served as inspiration for the `adaptive.Learner2D`.
226
239
227
-
<!-- rest-end -->
240
+
<!-- --8<-- [end:rest] -->
241
+
<!-- --8<-- [start:community] -->
228
242
229
243
For general discussion, we have a [Gitter chat channel](https://gitter.im/python-adaptive/adaptive).
230
244
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).
0 commit comments