Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: adaptive
name: adaptive-docs

channels:
- conda-forge
Expand All @@ -7,15 +7,16 @@ dependencies:
- python
- sortedcollections=2.1.0
- scikit-optimize=0.8.1
- scikit-learn=0.24.1
- scipy=1.6.1
- holoviews=1.13.3
- bokeh=2.2.1
- plotly=4.14.3
- ipywidgets=7.6.3
- jupyter_sphinx=0.3.1
- scikit-learn=0.24.2
- scipy=1.7.1
- holoviews=1.14.6
- bokeh=2.4.0
- panel=0.12.3
- plotly=5.3.1
- ipywidgets=7.6.5
- jupyter-sphinx=0.3.2
- atomicwrites=1.4.0
- sphinx_fontawesome=0.0.6
- sphinx=3.5.2
- m2r2=0.2.7
- sphinx_rtd_theme=0.5.1
- sphinx=4.2.0
- m2r2=0.3.1
- sphinx_rtd_theme=1.0.0
4 changes: 2 additions & 2 deletions docs/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.ignore-css{all:unset !important;}

/* https://gitter.im/pyviz/pyviz?at=5e8efb2b16f84f0461683446 */
.widget-box.bk form {
display: flex !important;
.panel-widget-box.bk form {
display: none !important;
margin-left: auto !important;
margin-right: auto !important;
width: 25%;
Expand Down
9 changes: 7 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@
}

html_js_files = [
"https://cdn.bokeh.org/bokeh/release/bokeh-2.2.1.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.2.1.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.0.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.0.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.0.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.0.min.js",
"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.0.min.js",
]


html_logo = "logo_docs.png"


Expand Down
19 changes: 11 additions & 8 deletions docs/source/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ on the *Play* :fa:`play` button or move the sliders.
from adaptive.learner.learner1D import uniform_loss, default_loss
import holoviews as hv
import numpy as np

adaptive.notebook_extension()
%output holomap='scrubber'
hv.output(holomap="scrubber")

`adaptive.Learner1D`
~~~~~~~~~~~~~~~~~~~~

.. jupyter-execute::
:hide-code:

%%opts Layout [toolbar=None]
def f(x, offset=0.07357338543088588):
a = 0.01
return x + a**2 / (a**2 + (x - offset)**2)
Expand All @@ -71,20 +71,23 @@ on the *Play* :fa:`play` button or move the sliders.
x, y = [x_0, x_1], [y_0, y_1]
else:
x, y = [], []
return hv.Scatter((x, y)).opts(style=dict(size=6, color='r'))
return hv.Scatter((x, y)).opts(style=dict(size=6, color="r"))

def plot(learner, npoints):
adaptive.runner.simple(learner, lambda l: l.npoints == npoints)
return (learner.plot() * plot_loss_interval(learner))[:, -1.1:1.1]

def get_hm(loss_per_interval, N=101):
learner = adaptive.Learner1D(f, bounds=(-1, 1),
loss_per_interval=loss_per_interval)
learner = adaptive.Learner1D(f, bounds=(-1, 1), loss_per_interval=loss_per_interval)
plots = {n: plot(learner, n) for n in range(N)}
return hv.HoloMap(plots, kdims=['npoints'])
return hv.HoloMap(plots, kdims=["npoints"])

layout = (
get_hm(uniform_loss).relabel("homogeneous samping")
+ get_hm(default_loss).relabel("with adaptive")
)

(get_hm(uniform_loss).relabel('homogeneous samping')
+ get_hm(default_loss).relabel('with adaptive'))
layout.opts(plot=dict(toolbar=None))

`adaptive.Learner2D`
~~~~~~~~~~~~~~~~~~~~
Expand Down