... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 | 3 |
import itertools |
4 |
+import warnings |
|
4 | 5 |
from collections import OrderedDict |
5 | 6 |
from copy import copy |
6 | 7 |
from math import sqrt |
7 |
-import warnings |
|
8 | 8 |
|
9 | 9 |
import numpy as np |
10 | 10 |
from scipy import interpolate |
... | ... |
@@ -95,9 +95,11 @@ def uniform_loss(ip): |
95 | 95 |
... x, y = xy |
96 | 96 |
... return x**2 + y**2 |
97 | 97 |
>>> |
98 |
- >>> learner = adaptive.Learner2D(f, |
|
99 |
- ... bounds=[(-1, -1), (1, 1)], |
|
100 |
- ... loss_per_triangle=uniform_loss) |
|
98 |
+ >>> learner = adaptive.Learner2D( |
|
99 |
+ ... f, |
|
100 |
+ ... bounds=[(-1, -1), (1, 1)], |
|
101 |
+ ... loss_per_triangle=uniform_loss, |
|
102 |
+ ... ) |
|
101 | 103 |
>>> |
102 | 104 |
""" |
103 | 105 |
return np.sqrt(areas(ip)) |
... | ... |
@@ -123,10 +125,7 @@ def resolution_loss_function(min_distance=0, max_distance=1): |
123 | 125 |
... return x**2 + y**2 |
124 | 126 |
>>> |
125 | 127 |
>>> loss = resolution_loss_function(min_distance=0.01, max_distance=1) |
126 |
- >>> learner = adaptive.Learner2D(f, |
|
127 |
- ... bounds=[(-1, -1), (1, 1)], |
|
128 |
- ... loss_per_triangle=loss) |
|
129 |
- >>> |
|
128 |
+ >>> learner = adaptive.Learner2D(f, bounds=[(-1, -1), (1, 1)], loss_per_triangle=loss) |
|
130 | 129 |
""" |
131 | 130 |
|
132 | 131 |
def resolution_loss(ip): |
... | ... |
@@ -192,7 +191,7 @@ def minimize_triangle_surface_loss(ip): |
192 | 191 |
|
193 | 192 |
|
194 | 193 |
def default_loss(ip): |
195 |
- """Loss function that combines |
|
194 |
+ """Loss function that combines `deviations` and `areas` of the triangles. |
|
196 | 195 |
|
197 | 196 |
Works with `~adaptive.Learner2D` only. |
198 | 197 |
|
... | ... |
@@ -222,15 +221,15 @@ def choose_point_in_triangle(triangle, max_badness): |
222 | 221 |
|
223 | 222 |
Parameters |
224 | 223 |
---------- |
225 |
- triangle : numpy array |
|
226 |
- The coordinates of a triangle with shape (3, 2) |
|
224 |
+ triangle : numpy.ndarray |
|
225 |
+ The coordinates of a triangle with shape (3, 2). |
|
227 | 226 |
max_badness : int |
228 | 227 |
The badness at which the point is either chosen on a edge or |
229 | 228 |
in the middle. |
230 | 229 |
|
231 | 230 |
Returns |
232 | 231 |
------- |
233 |
- point : numpy array |
|
232 |
+ point : numpy.ndarray |
|
234 | 233 |
The x and y coordinate of the suggested new point. |
235 | 234 |
""" |
236 | 235 |
a, b, c = triangle |