Skip to content

Commit 8934dc1

Browse files
authored
add short code example to the README.rst
1 parent c339f01 commit 8934dc1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.rst

+15
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ with built-in support for
6363
Examples
6464
--------
6565

66+
Adaptively learning a 1D function (the `gif` below) and live-plotting the process in a Jupyter notebook is as easy as
67+
68+
.. code:: python
69+
70+
from adaptive import notebook_extension, Runner, Learner1D
71+
notebook_extension()
72+
73+
def peak(x, a=0.01):
74+
return x + a**2 / (a**2 + x**2)
75+
76+
learner = Learner1D(peak, bounds=(-1, 1))
77+
runner = Runner(learner, goal=lambda l: l.loss() < 0.01)
78+
runner.live_info()
79+
80+
6681
.. raw:: html
6782

6883
<img src="https://user-images.githubusercontent.com/6897215/38739170-6ac7c014-3f34-11e8-9e8f-93b3a3a3d61b.gif" width='20%'> </img> <img src="https://user-images.githubusercontent.com/6897215/35219611-ac8b2122-ff73-11e7-9332-adffab64a8ce.gif" width='40%'> </img> <img src="https://user-images.githubusercontent.com/6897215/47256441-d6d53700-d480-11e8-8224-d1cc49dbdcf5.gif" width='20%'> </img>

0 commit comments

Comments
 (0)