Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 10, 2023
1 parent 73f258c commit de69570
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion adaptive/learner/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
ones,
square,
subtract,
zeros,
)
from numpy import sum as np_sum
from numpy import zeros
from numpy.linalg import det as ndet
from numpy.linalg import matrix_rank, norm, slogdet, solve

Expand Down
2 changes: 1 addition & 1 deletion docs/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import holoviews
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.tri as mtri
import numpy as np
from PIL import Image, ImageDraw

sys.path.insert(0, os.path.abspath("..")) # to get adaptive on the path
Expand Down
6 changes: 4 additions & 2 deletions docs/source/algorithms_and_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ Click on the *Play* {fa}`play` button or move the sliders.
:tags: [hide-cell]
import itertools
import adaptive
from adaptive.learner.learner1D import uniform_loss, default_loss
import holoviews as hv
import numpy as np
import adaptive
from adaptive.learner.learner1D import default_loss, uniform_loss
adaptive.notebook_extension()
hv.output(holomap="scrubber")
```
Expand Down
14 changes: 8 additions & 6 deletions docs/source/tutorial/tutorial.AverageLearner1D.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
kernelspec:
name: python3
display_name: python3
jupytext:
text_representation:
extension: .md
format_name: myst
format_version: '0.13'
jupytext_version: 1.13.8
format_version: 0.13
jupytext_version: 1.14.5
kernelspec:
display_name: python3
name: python3
---

# Tutorial {class}`~adaptive.AverageLearner1D`

```{note}
Expand All @@ -23,9 +24,10 @@ import adaptive
adaptive.notebook_extension()
from functools import partial
import holoviews as hv
import numpy as np
from functools import partial
```

## General use
Expand Down
5 changes: 3 additions & 2 deletions docs/source/tutorial/tutorial.BalancingLearner.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ import adaptive
adaptive.notebook_extension()
import random
from functools import partial
import holoviews as hv
import numpy as np
from functools import partial
import random
```

The balancing learner is a “meta-learner” that takes a list of learners.
Expand Down
9 changes: 5 additions & 4 deletions docs/source/tutorial/tutorial.Learner1D.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import adaptive
adaptive.notebook_extension()
import numpy as np
from functools import partial
import random
from functools import partial
import numpy as np
```

## scalar output: `f:ℝ → ℝ`
Expand All @@ -41,8 +42,8 @@ offset = random.uniform(-0.5, 0.5)
def f(x, offset=offset, wait=True):
from time import sleep
from random import random
from time import sleep
a = 0.01
if wait:
Expand Down Expand Up @@ -155,8 +156,8 @@ To do this, you need to tell the learner to look at the curvature by specifying
```{code-cell} ipython3
from adaptive.learner.learner1D import (
curvature_loss_function,
uniform_loss,
default_loss,
uniform_loss,
)
curvature_loss = curvature_loss_function()
Expand Down
10 changes: 6 additions & 4 deletions docs/source/tutorial/tutorial.Learner2D.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ Download the notebook in order to see the real behaviour. [^download]
```{code-cell} ipython3
:tags: [hide-cell]
import adaptive
from functools import partial
import holoviews as hv
import numpy as np
from functools import partial
import adaptive
adaptive.notebook_extension()
```
Expand All @@ -33,9 +34,10 @@ Besides 1D functions, we can also learn 2D functions: $f: ℝ^2 → ℝ$.

```{code-cell} ipython3
def ring(xy, wait=True):
import numpy as np
from time import sleep
from random import random
from time import sleep
import numpy as np
if wait:
sleep(random() / 10)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorial/tutorial.custom_loss.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import adaptive
adaptive.notebook_extension()
# Import modules that are used in multiple cells
import numpy as np
import holoviews as hv
import numpy as np
```

{class}`~adaptive.Learner1D` and {class}`~adaptive.Learner2D` both work on the principle of subdividing their domain into subdomains, and assigning a property to each subdomain, which we call the *loss*.
Expand Down Expand Up @@ -137,7 +137,7 @@ def resolution_loss_function(min_distance=0, max_distance=1):
because the total area is normalized to 1."""
def resolution_loss(ip):
from adaptive.learner.learner2D import default_loss, areas
from adaptive.learner.learner2D import areas, default_loss
loss = default_loss(ip)
Expand Down

0 comments on commit de69570

Please sign in to comment.