← 开源
python-adaptive

adaptive

:chart_with_upwards_trend: Adaptive: parallel active learning of mathematical functions

Model DevelopmentTraining toolkitsPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
1.23k
Star
64
Fork
+0
本周
19
贡献者
创建于 2017-12-10 · 更新于 2026-10-15 · 今日第 11050 名
主要开发者

python-adaptive/adaptive 排名第 11,050,有 1,230 个星标。

同类别比较

python-adaptive/adaptive 排名第 11,050,此处有 8 个同类条目;yuanxiaosc/Entity-Relation-Extraction 排名第 11,052。

同类别比较
名称排名指标
ivan-vasilev/neuralnetworks11,027
语言:
Java
星标数:
1,236
分叉数:
345
简介:
java deep learning algorithms and deep neural networks with gpu acceleration
BR-IDL/PaddleViT11,029
语言:
Python
星标数:
1,235
分叉数:
328
简介:
:robot: PaddleViT: State-of-the-art Visual Transformer and MLP Models for PaddlePaddle 2.0+
jakesnell/prototypical-networks11,031
语言:
Python
星标数:
1,235
分叉数:
270
简介:
Code for the NeurIPS 2017 Paper "Prototypical Networks for Few-shot Learning"
jfzhang95/pytorch-video-recognition11,038
语言:
Python
星标数:
1,234
分叉数:
251
简介:
PyTorch implemented C3D, R3D, R2Plus1D models for video activity recognition.
yuanxiaosc/Entity-Relation-Extraction11,052
语言:
Python
星标数:
1,230
分叉数:
269
简介:
Entity and Relation Extraction Based on TensorFlow and BERT. 基于TensorFlow和BERT的管道式实体及关系抽取,2019语言与智能技术竞赛信息抽取任务解决方案。Schema based Knowledge Extraction, SKE 2019
huoyijie/AdvancedEAST11,054
语言:
Python
星标数:
1,229
分叉数:
371
简介:
AdvancedEAST is an algorithm used for Scene image text detect, which is primarily based on EAST, and the significant improvement was also made, which make long text predictions more accurate.https://github.com/huoyijie/raspberrypi-car
Genesis-Embodied-AI/RoboGen11,058
语言:
Python
星标数:
1,228
分叉数:
108
简介:
A generative and self-guided robotic agent that endlessly propose and master new skills.
rohanpsingh/LearningHumanoidWalking11,061
语言:
Python
星标数:
1,228
分叉数:
139
简介:
Training a humanoid robot for locomotion using Reinforcement Learning
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Training toolkits
星标数1,230
分叉数64
贡献者19
创建日期2017-12-10
更新日期2026-10-15
1 天星标数0
7 天星标数0
排名11,050
上次排名11,004
排名变化-46
7 天星标排名12,866
上次 7 天星标排名12,884
7 天星标排名变化18
总星标排名9,501
上次总星标排名9,494
总星标排名变化-7
README 摘录

is an open-source Python library for adaptive parallel function evaluation. You supply a function and its bounds, and evaluates it at the "best" points in parameter space, instead of at *all* points of a dense grid. With a few lines of code you can run the evaluations on a computing cluster, live-plot the data as it comes in, and fine-tune the sampling algorithm. works best when each function evaluation takes *at least* ≈50 ms, because picking the

next points has some overhead. It is meant for functions of a few parameters: with more dimensions, quickly becomes slower and less effective. Try the example notebook on Binder or read the tutorial. With the same number of points, adaptive sampling resolves features that a homogeneous grid misses: Example Learning a 1D function and live-plotting the process in a Jupyter notebook: The works in the background, so the notebook stays usable while it runs. In a script, use , which

returns once the goal is reached: returns the same data as a pandas DataFrame (pandas comes with the extra). Implemented algorithms The core concept in is the *learner*. A learner samples a function at the points in its parameter space that tell it the most about the function. As it evaluates more points, it gets a better idea of where to sample next. What the "best" points are depends on your application. Each learner ranks candidate points with a *loss

function*. The default losses put more points where the function changes quickly; you can pass a built-in alternative, such as or , or write your own (see the custom loss tutorial). The following learners are implemented: , for 1D functions , , for 2D functions , , for ND functions , , for random variables where you want to average the result over many evaluations, , for stochastic 1D functions where you want to estimate the mean value of the function at each point, , for when you want

to integrate a 1D function , , for when you want to evaluate a fixed sequence of points while still using the runners and data export of . Meta-learners (to be used with other learners): , for when you want to run several learners at once, selecting the "best" one each time you get more points, , for when your function doesn't just return a scalar or a vector. In addition to the learners, provides primitives for running the sampling across several cores and

even several machines, with built-in support for concurrent. futures, mpi4py, loky, ipyparallel, and distributed. By default, both runners evaluate the function in parallel on all cores of the local machine, using loky. To use one of the others, pass it as , for example ; the parallelism tutorial has an example for each. 11 and higher on Linux, Windows, and macOS. Install it with : or from PyPI: Add the extra ( ) for live plotting and widgets in JupyterLab and Jupyter Notebook, and

for ; no Jupyter extensions are needed. Faster triangulation (optional) Installing the optional adaptive-triangulation package makes significantly faster by replacing

常见问题

记录了多少星标和分叉?

python-adaptive/adaptive 有 1,230 个星标和 64 个分叉。

仓库排名是多少?

python-adaptive/adaptive 排名第 11,050。

记录的语言和类别是什么?

python-adaptive/adaptive 有 1,230 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

python-adaptive/adaptive 与 yuanxiaosc/Entity-Relation-Extraction 比较,后者排名第 11,052,有 1,230 个星标。

README

Adaptive: Parallel Active Learning of Mathematical Functions

adaptive is an open-source Python library for adaptive parallel function evaluation. You supply a function and its bounds, and adaptive evaluates it at the "best" points in parameter space, instead of at all points of a dense grid. With a few lines of code you can run the evaluations on a computing cluster, live-plot the data as it comes in, and fine-tune the sampling algorithm.

adaptive works best when each function evaluation takes at least ≈50 ms, because picking the next points has some overhead. It is meant for functions of a few parameters: with more dimensions, LearnerND quickly becomes slower and less effective.

Try the example notebook on Binder or read the tutorial.

With the same number of points, adaptive sampling resolves features that a homogeneous grid misses:

Example

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

from adaptive import notebook_extension, Runner, Learner1D

notebook_extension()


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


learner = Learner1D(peak, bounds=(-1, 1))
runner = Runner(learner, loss_goal=0.01)
runner.live_info()
runner.live_plot()

The Runner works in the background, so the notebook stays usable while it runs. In a script, use BlockingRunner, which returns once the goal is reached:

from adaptive import BlockingRunner, Learner1D


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


learner = Learner1D(peak, bounds=(-1, 1))
BlockingRunner(learner, loss_goal=0.01)
data = learner.to_numpy()  # array with columns x, y

learner.to_dataframe() returns the same data as a pandas DataFrame (pandas comes with the [notebook] extra).

Implemented algorithms

The core concept in adaptive is the learner. A learner samples a function at the points in its parameter space that tell it the most about the function. As it evaluates more points, it gets a better idea of where to sample next.

What the "best" points are depends on your application. Each learner ranks candidate points with a loss function. The default losses put more points where the function changes quickly; you can pass a built-in alternative, such as curvature_loss_function() or resolution_loss_function(), or write your own (see the custom loss tutorial).

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 where you want to average the result over many evaluations,
  • AverageLearner1D, for stochastic 1D functions where you want to estimate the mean value of the function at each point,
  • IntegratorLearner, for when you want to integrate a 1D function f: ℝ → ℝ,
  • SequenceLearner, for when you want to evaluate a fixed sequence of points while still using the runners and data export of adaptive.

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

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

In addition to the learners, adaptive provides primitives for running the sampling across several cores and even several machines, with built-in support for concurrent.futures, mpi4py, loky, ipyparallel, and distributed.

By default, both runners evaluate the function in parallel on all cores of the local machine, using loky. To use one of the others, pass it as executor, for example Runner(learner, executor=distributed.Client()); the parallelism tutorial has an example for each.

Installation

adaptive works with Python 3.11 and higher on Linux, Windows, and macOS.

Install it with conda:

conda install -c conda-forge adaptive

or from PyPI:

pip install adaptive

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:

pip install "adaptive[rust]"

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

pre-commit install

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

排名相邻
同类项目