adaptive

:chart_with_upwards_trend: Adaptive: parallel active learning of mathematical functions

https://github.com/python-adaptive/adaptive

Science Score: 39.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary

Keywords

active-learning adaptive adaptive-learning adaptive-sampling live-plots machine-learning parallel parallel-computing python

Keywords from Contributors

closember gtk qt tk wx mesh
Last synced: 6 months ago · JSON representation

Repository

:chart_with_upwards_trend: Adaptive: parallel active learning of mathematical functions

Basic Info
Statistics
  • Stars: 1,201
  • Watchers: 15
  • Forks: 62
  • Open Issues: 104
  • Releases: 35
Topics
active-learning adaptive adaptive-learning adaptive-sampling live-plots machine-learning parallel parallel-computing python
Created about 8 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Authors Zenodo

README.md

logo Adaptive: Parallel Active Learning of Mathematical Functions :brain::1234:

Binder Conda Coverage DOI Documentation Downloads GitHub Gitter PyPI

Adaptive is an open-source Python library that streamlines adaptive parallel function evaluations. 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. With minimal code, you can perform evaluations on a computing cluster, display live plots, and optimize the adaptive sampling algorithm.

Adaptive is most efficient for computations where each function evaluation takes at least ≈50ms due to the overhead of selecting potentially interesting points.

To see Adaptive in action, try the example notebook on Binder or explore the tutorial on Read the Docs.

[ToC] 📚 - [:star: Key features](#star-key-features) - [:rocket: Example usage](#rocket-example-usage) - [:floppy_disk: Exporting Data](#floppy_disk-exporting-data) - [:test_tube: Implemented Algorithms](#test_tube-implemented-algorithms) - [:package: Installation](#package-installation) - [:wrench: Development](#wrench-development) - [:books: Citing](#books-citing) - [:page_facing_up: Draft Paper](#page_facing_up-draft-paper) - [:sparkles: Credits](#sparkles-credits)

:star: Key features

  • 🎯 Intelligent Adaptive Sampling: Adaptive focuses on areas of interest within a function, ensuring better results with fewer evaluations, saving time, and computational resources.
  • Parallel Execution: The library leverages parallel processing for faster function evaluations, making optimal use of available computational resources.
  • 📊 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.
  • 🔧 Customizable Loss Functions: Adaptive supports various loss functions and allows customization, enabling users to tailor the learning process according to their specific needs.
  • 📈 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.
  • 🧩 Seamless Integration: Adaptive offers a simple and intuitive interface, making it easy to integrate with existing Python projects and workflows.
  • 💾 Flexible Data Export: The library provides options to export learned data as NumPy arrays or Pandas DataFrames, ensuring compatibility with various data processing tools.
  • 🌐 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.

:rocket: Example usage

Adaptively learning a 1D function and live-plotting the process in a Jupyter notebook:

```python from adaptive import notebook_extension, Runner, Learner1D

notebook_extension()

def peak(x, a=0.01): return x + a2 / (a2 + x**2)

learner = Learner1D(peak, bounds=(-1, 1)) runner = Runner(learner, lossgoal=0.01) runner.liveinfo() runner.live_plot() ```

:floppy_disk: Exporting Data

You can export the learned data as a NumPy array:

python data = learner.to_numpy()

If you have Pandas installed, you can also export the data as a DataFrame:

python df = learner.to_dataframe()

:test_tube: Implemented Algorithms

The core concept in adaptive is the learner. A learner samples a function at the most interesting locations within its parameter space, allowing for optimal sampling of the function. As the function is evaluated at more points, the learner improves its understanding of the best locations to sample next.

The definition of the "best locations" depends on your application domain. While adaptive provides sensible default choices, the adaptive sampling process can be fully customized.

The following learners are implemented:

  • Learner1D: for 1D functions f: ℝ → ℝ^N,
  • Learner2D: for 2D functions f: ℝ^2 → ℝ^N,
  • LearnerND: for ND functions f: ℝ^N → ℝ^M,
  • AverageLearner: for random variables, allowing averaging of results over multiple evaluations,
  • AverageLearner1D: for stochastic 1D functions, estimating the mean value at each point,
  • IntegratorLearner: for integrating a 1D function f: ℝ → ℝ,
  • BalancingLearner: for running multiple learners simultaneously and selecting the "best" one as more points are gathered.

Meta-learners (to be used with other learners):

  • BalancingLearner: for running several learners at once, selecting the "most optimal" one each time you get more points,
  • DataSaver: for when your function doesn't return just a scalar or a vector.

In addition to learners, adaptive offers primitives for parallel sampling across multiple cores or machines, with built-in support for: concurrent.futures, mpi4py, loky, ipyparallel, and distributed.

:package: Installation

adaptive works with Python 3.7 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:

bash conda install -c conda-forge adaptive

adaptive is also available on PyPI:

bash 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.

bash jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter labextension install @pyviz/jupyterlab_pyviz

:wrench: Development

Clone the repository and run pip install -e ".[notebook,test,other]" to add a link to the cloned repo into your Python path:

bash git clone git@github.com:python-adaptive/adaptive.git cd adaptive pip install -e ".[notebook,test,other]"

We recommend using a Conda environment or a virtualenv for package management during Adaptive development.

To avoid polluting the history with notebook output, set up the git filter by running:

bash python ipynb_filter.py

in the repository.

To maintain consistent code style, we use pre-commit. Install it by running:

bash pre-commit install

in the repository.

:books: Citing

If you used Adaptive in a scientific work, please cite it as follows.

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

:pagefacingup: Draft Paper

If you're interested in the scientific background and principles behind Adaptive, we recommend taking a look at the draft paper that is currently being written. This paper provides a comprehensive overview of the concepts, algorithms, and applications of the Adaptive library.

:sparkles: 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 AdaptiveTriSampling script (no longer available online since SciPy Central went down) which served as inspiration for the adaptive.Learner2D.

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.

Owner

  • Name: python-adaptive
  • Login: python-adaptive
  • Kind: organization

GitHub Events

Total
  • Create event: 9
  • Release event: 4
  • Issues event: 7
  • Watch event: 36
  • Delete event: 4
  • Issue comment event: 22
  • Push event: 71
  • Pull request review comment event: 1
  • Pull request review event: 4
  • Pull request event: 21
  • Fork event: 4
Last Year
  • Create event: 9
  • Release event: 4
  • Issues event: 7
  • Watch event: 36
  • Delete event: 4
  • Issue comment event: 22
  • Push event: 71
  • Pull request review comment event: 1
  • Pull request review event: 4
  • Pull request event: 21
  • Fork event: 4

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 1,873
  • Total Committers: 21
  • Avg Commits per committer: 89.19
  • Development Distribution Score (DDS): 0.445
Past Year
  • Commits: 118
  • Committers: 8
  • Avg Commits per committer: 14.75
  • Development Distribution Score (DDS): 0.254
Top Committers
Name Email Commits
Bas Nijholt b****t@g****m 1,040
Bas Nijholt b****s@n****t 385
Jorn Hoofwijk j****k@g****m 192
Joseph Weston j****h@w****d 187
philippeitis 3****s 14
pre-commit-ci[bot] 6****] 10
Anton Akhmerov a****v@g****m 10
AlvaroGI a****a@g****m 8
Juan Daniel Torres j****5@g****m 5
Joseph Weston v****e@m****m 4
caenrigen 3****n 4
Juan Daniel Torres j****s@J****e 3
Juan Daniel Torres j****s@J****l 3
Davide Sandonà s****e@g****m 1
Thomas A Caswell t****l@g****m 1
Pieter Eendebak p****k@g****m 1
Andrea Maiani a****i@g****m 1
Juan Daniel Torres j****s@g****m 1
Sultan Orazbayev c****t@e****m 1
Andrey E. Antipov A****v@g****m 1
Thomas Aarholt t****t@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 28
  • Total pull requests: 135
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 2 months
  • Total issue authors: 19
  • Total pull request authors: 9
  • Average comments per issue: 1.71
  • Average comments per pull request: 1.19
  • Merged pull requests: 97
  • Bot issues: 0
  • Bot pull requests: 17
Past Year
  • Issues: 5
  • Pull requests: 13
  • Average time to close issues: about 8 hours
  • Average time to close pull requests: 2 days
  • Issue authors: 2
  • Pull request authors: 3
  • Average comments per issue: 0.6
  • Average comments per pull request: 0.62
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • serhiy-yevtushenko (4)
  • bonh (3)
  • basnijholt (2)
  • hz-xiaxz (2)
  • juandaanieel (2)
  • voloddia (2)
  • iarayad (1)
  • Davide-sd (1)
  • terrorfisch (1)
  • RobvanGastel (1)
  • lsyxiaopang (1)
  • eendebakpt (1)
  • Niels-Skovgaard-Jensen (1)
  • akhmerov (1)
  • orbisvicis (1)
Pull Request Authors
  • basnijholt (105)
  • pre-commit-ci[bot] (17)
  • jbweston (5)
  • eendebakpt (3)
  • juandaanieel (2)
  • stuartthomas25 (1)
  • maiani (1)
  • krokosik (1)
  • philippeitis (1)
Top Labels
Issue Labels
Documentation (1) question (1)
Pull Request Labels
Blocked (1) enhancement (1) LearnerND (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 40,395 last-month
  • Total docker downloads: 385
  • Total dependent packages: 5
    (may contain duplicates)
  • Total dependent repositories: 17
    (may contain duplicates)
  • Total versions: 121
  • Total maintainers: 2
pypi.org: adaptive

Parallel active learning of mathematical functions

  • Versions: 40
  • Dependent Packages: 4
  • Dependent Repositories: 16
  • Downloads: 40,395 Last month
  • Docker Downloads: 385
Rankings
Dependent packages count: 1.9%
Docker downloads count: 2.2%
Average: 2.9%
Dependent repos count: 3.6%
Downloads: 3.8%
Maintainers (2)
Last synced: 6 months ago
proxy.golang.org: github.com/python-adaptive/adaptive
  • Versions: 52
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.4%
Average: 6.7%
Dependent repos count: 6.9%
Last synced: 6 months ago
conda-forge.org: adaptive

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

  • Versions: 29
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Stargazers count: 14.6%
Average: 23.6%
Dependent repos count: 24.4%
Forks count: 26.3%
Dependent packages count: 29.0%
Last synced: 6 months ago

Dependencies

docs/environment.yml conda
  • atomicwrites 1.4.0.*
  • bokeh 2.4.0.*
  • cloudpickle
  • ffmpeg 4.3.2.*
  • holoviews 1.14.6.*
  • ipywidgets 7.6.5.*
  • jupyter-sphinx 0.3.2.*
  • loky
  • m2r2 0.3.1.*
  • panel 0.12.7.*
  • plotly 5.3.1.*
  • python
  • scikit-learn 0.24.2.*
  • scikit-optimize 0.8.1.*
  • scipy 1.7.1.*
  • sortedcollections 2.1.0.*
  • sphinx 4.2.0.*
  • sphinx_fontawesome 0.0.6.*
  • sphinx_rtd_theme 1.0.0.*
environment.yml conda
  • atomicwrites
  • cloudpickle
  • distributed
  • holoviews
  • ipykernel >=4.8*
  • ipyparallel >=6.2.5
  • ipywidgets
  • jupyter_client >=5.2.2
  • loky
  • plotly
  • python 3.9.*
  • scikit-learn <=0.24.2
  • scikit-optimize >=0.8.1
  • scipy
  • sortedcollections
  • sortedcontainers
setup.py pypi
  • atomicwrites *
  • cloudpickle *
  • loky *
  • scipy *
  • sortedcollections *
  • sortedcontainers *
.github/workflows/coverage.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v2 composite
.github/workflows/nox.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v2 composite
.github/workflows/pre-commit.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pre-commit/action v2.0.0 composite
.github/workflows/pythonpublish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/typeguard.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v2 composite