python-adaptive/adaptive
:chart_with_upwards_trend: Adaptive: parallel active learning of mathematical functions
What it solves
adaptive solves the problem of evaluating an expensive mathematical function efficiently. Instead of sampling the function on a dense, evenly spaced grid (which wastes effort in smooth regions and misses sharp features), it chooses the next points to evaluate based on what it has already learned. This gives you a good approximation with far fewer function evaluations.
How it works
You give adaptive a function and the bounds of the parameter space you care about. A learner decides which points are most informative to sample next, using a loss function that ranks candidate points — by default, it puts more points where the function changes quickly. You can swap in built-in alternatives (e.g., curvature-based or resolution-based) or write your own. The library includes learners for 1D, 2D, and N‑D functions, plus special ones for averaging noisy results, integrating, or evaluating a fixed sequence. A Runner executes the sampling in parallel — on all local cores by default, or on a cluster via concurrent.futures, mpi4py, loky, ipyparallel, or distributed. You can live-plot the data as it arrives in a Jupyter notebook, and export the final results as a NumPy array or pandas DataFrame.
Who it's for
Researchers, scientists, and engineers who need to evaluate mathematical functions that take at least ~50 ms per call (so the overhead of choosing points is worth it). It works best for functions of a few parameters — the built-in N‑D learner becomes slower and less effective as dimensions grow. It's also useful for anyone who wants to run such evaluations in parallel across cores or machines without writing that plumbing themselves.
Highlights
- Adaptive sampling: concentrates evaluations where the function changes most, resolving features a uniform grid would miss.
- Parallel execution: runs on all local cores by default, with pluggable support for several cluster backends.
- Live visualization: Jupyter widgets and live plots let you watch the learning process in real time.
- Multiple learners: 1D, 2D, ND, averaging, integration, and sequence learners, plus meta-learners like
BalancingLearnerandDataSaver. - Customizable loss functions: choose built-in alternatives or define your own to control where points are added.
- Easy data export: get results as a NumPy array or pandas DataFrame.
- Optional Rust acceleration: installing
adaptive[rust]makes the N‑D triangulation significantly faster, with no code changes.
Related
- Project
- Project
- Project
- Project
- Project