Installation and development¶
Installation¶
adaptive works with Python 3.11 and higher on Linux, Windows, and macOS.
Install it with conda:
or from PyPI:
Add the [notebook] extra (pip install "adaptive[notebook]") for live plotting and widgets in JupyterLab and Jupyter Notebook, and for to_dataframe(); no Jupyter extensions are needed.
Faster triangulation (optional)¶
Installing the optional adaptive-triangulation package makes adaptive.LearnerND significantly faster by replacing the pure-Python triangulation with a Rust implementation:
No code changes are needed. The Rust backend is detected and used automatically.
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).
Development¶
Clone the repository and install it in editable mode with the optional dependencies:
git clone https://github.com/python-adaptive/adaptive.git
cd adaptive
pip install -e ".[notebook,test,other]"
We recommend a virtual environment, for example with uv (uv sync --extra notebook --extra test --extra other) or Conda.
We use pre-commit for a consistent code style; install the hooks with
Run the tests with pytest.
If you edit example-notebook.ipynb, install nbconvert and run python ipynb_filter.py once, so git strips the notebook output on commit.
Building the documentation¶
The documentation is built with Zensical.
The executable pages in docs/notebooks/ are Jupyter notebooks in jupytext's MyST Markdown format.
docs/build_notebooks.py executes them (with caching) and renders them into docs/, after which Zensical builds the site:
uv run --group docs python docs/build_notebooks.py
uv run --group docs zensical serve # preview on http://localhost:8000
The README animations are made from real learner runs with uv run --group docs python docs/make_animations.py, which needs ffmpeg and Chrome or Chromium.
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}
}
The algorithms are described in more detail in a draft paper.
Credits¶
We would like to give credits to the following people:
- Pedro Gonnet for his implementation of CQUAD, "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.
- Pauli Virtanen for his
AdaptiveTriSamplingscript (no longer available online since SciPy Central went down), which served as inspiration foradaptive.Learner2D.
Authors¶
The current maintainers of Adaptive are:
Other contributors to Adaptive include:
- Andrey E. Antipov (@aeantipov)
- Christoph Groth
- Jorn Hoofwijk (@jhoofwijk)
- Philippe Solodov (@philippeitis)
- Victor Negîrneac (@caenrigen)
- Thomas A Caswell (@tacaswell)
- Álvaro Gómez Iñesta (@AlvaroGI)
- Sultan Orazbayev (@SultanOrazbayev)
- Thomas Aarholt (@thomasaarholt)
- Andrea Maiani (@maiani)
- Juan Daniel Torres (@juandaanieel)
- Davide Sandonà (@juandaanieel)
- Pieter Eendebak (@eendebakpt)
For general discussion, we have a Gitter chat channel. If you find any bugs or have any feature suggestions, please file a GitHub issue or submit a pull request.