Skip to content

Commit f5631ac

Browse files
AlvaroGIbasnijholt
authored andcommitted
Changed variable name from min_Delta_g to min_error
1 parent eb2990c commit f5631ac

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

adaptive/learner/average_learner1D.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ class AverageLearner1D(Learner1D):
2121
interval.
2222
We strongly recommend 0 < delta <= 1.
2323
alpha : float (0 < alpha < 1)
24-
The size of the interval of confidence of the estimate of the mean
25-
is 1-2*alpha. We recommend to keep alpha=0.005.
24+
The true value of the function at x is within the confidence interval
25+
[self.data[x] - self._error_in_mean[x], self.data[x] +
26+
self._error_in_mean[x]] with probability 1-2*alpha.
27+
We recommend to keep alpha=0.005.
2628
neighbor_sampling : float (0 < neighbor_sampling <= 1)
2729
Each new point is initially sampled at least a (neighbor_sampling*100)%
2830
of the average number of samples of its neighbors.
@@ -31,9 +33,14 @@ class AverageLearner1D(Learner1D):
3133
sampled at least min_samples times.
3234
max_samples : int (min_samples < max_samples)
3335
Maximum number of samples at each point x.
34-
min_Delta_g : float (min_Delta_g >= 0)
35-
Minimum uncertainty. If the uncertainty at a certain point is below this
36-
threshold, the point will not be resampled again.
36+
min_error : float (min_error >= 0)
37+
Minimum size of the confidence intervals. The true value of the
38+
function at x is within the confidence interval [self.data[x] -
39+
self._error_in_mean[x], self.data[x] + self._error_in_mean[x]] with
40+
probability 1-2*alpha.
41+
If self._error_in_mean[x] < min_error, then x will not be resampled
42+
anymore, i.e., the smallest confidence interval at x is
43+
[self.data[x] - min_error, self.data[x] + min_error].
3744
"""
3845

3946
def __init__(
@@ -46,7 +53,7 @@ def __init__(
4653
neighbor_sampling=0.3,
4754
min_samples=50,
4855
max_samples=np.inf,
49-
min_Delta_g=0,
56+
min_error=0,
5057
):
5158
# Checks
5259
for k, v in zip(
@@ -64,7 +71,7 @@ def __init__(
6471
self.delta = delta
6572
self.alpha = alpha
6673
self.min_samples = min_samples
67-
self.min_Delta_g = min_Delta_g
74+
self.min_error = min_error
6875
self.max_samples = max_samples
6976
self.neighbor_sampling = neighbor_sampling
7077

@@ -258,7 +265,7 @@ def _update_data_structures(self, x, y, point_type):
258265
self._update_distances(x)
259266
self._update_rescaled_error_in_mean(x, "resampled")
260267

261-
if self._error_in_mean[x] <= self.min_Delta_g or n >= self.max_samples:
268+
if self._error_in_mean[x] <= self.min_error or n >= self.max_samples:
262269
self._rescaled_error_in_mean.pop(x, None)
263270

264271
# We also need to update scale and losses
@@ -358,7 +365,7 @@ def tell_many(self, xs, ys):
358365
self._error_in_mean[x] = self._calc_error_in_mean(self._data_samples[x], y_avg, n)
359366
self._update_distances(x)
360367
self._update_rescaled_error_in_mean(x, "resampled")
361-
if self._error_in_mean[x] <= self.min_Delta_g or n >= self.max_samples:
368+
if self._error_in_mean[x] <= self.min_error or n >= self.max_samples:
362369
self._rescaled_error_in_mean.pop(x, None)
363370

364371
super()._update_scale(x, y_avg)

0 commit comments

Comments
 (0)