Skip to content

Commit 5f0c07c

Browse files
committed
make the loss improvement equal to 1/len(sequence)
1 parent 8bfd429 commit 5f0c07c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

adaptive/learner/sequence_learner.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, function, sequence):
2727

2828
# We use a poor man's OrderedSet, a dict that points to None.
2929
self._to_do_seq = {ensure_hashable(x): None for x in sequence}
30-
self._npoints = len(sequence)
30+
self._ntotal = len(sequence)
3131
self.sequence = copy(sequence)
3232
self.data = {}
3333
self.pending_points = set()
@@ -39,7 +39,7 @@ def ask(self, n, tell_pending=True):
3939
if len(points) >= n:
4040
break
4141
points.append(point)
42-
loss_improvements.append(inf / self._npoints)
42+
loss_improvements.append(1 / self._ntotal)
4343

4444
if tell_pending:
4545
for p in points:
@@ -59,8 +59,7 @@ def loss(self, real=True):
5959
return 0
6060
else:
6161
npoints = self.npoints + (0 if real else len(self.pending_points))
62-
ntotal = len(self.sequence)
63-
return (ntotal - npoints) / ntotal
62+
return (self._ntotal - npoints) / self._ntotal
6463

6564
def remove_unfinished(self):
6665
for p in self.pending_points:

0 commit comments

Comments
 (0)