Skip to content

Commit c233ceb

Browse files
committed
change while loop to normal loop
1 parent dc846e1 commit c233ceb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

adaptive/learner/balancing_learner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,13 @@ def _ask_and_tell_based_on_loss(self, n):
163163
def _ask_and_tell_based_on_npoints(self, n):
164164
selected = [] # tuples ((learner_index, point), loss_improvement)
165165
total_points = [l.npoints + len(l.pending_points) for l in self.learners]
166-
n_left = n
167-
while n_left > 0:
166+
for _ in range(n):
168167
index = np.argmin(total_points)
169168
# Take the points from the cache
170169
if index not in self._ask_cache:
171170
self._ask_cache[index] = self.learners[index].ask(n=1)
172171
points, loss_improvements = self._ask_cache[index]
173172
total_points[index] += 1
174-
n_left -= 1
175173
selected.append(((index, points[0]), loss_improvements[0]))
176174
self.tell_pending((index, points[0]))
177175

0 commit comments

Comments
 (0)