Browse code

change loop into list comprehension

Bas Nijholt authored on 11/07/2018 05:18:21
Showing 1 changed files
... ...
@@ -283,10 +283,8 @@ class Learner1D(BaseLearner):
283 283
 
284 284
             # Calculate how many points belong to each interval.
285 285
             x_scale = self._scale[0]
286
-            quals = []
287
-            for x, loss in self.losses_combined.items():
288
-                quality = -loss if not math.isinf(loss) else -(x[1] - x[0]) / x_scale
289
-                quals.append((quality, x, 1))
286
+            quals = [((-loss if not math.isinf(loss) else -(x[1] - x[0]) / x_scale, x, 1))
287
+                     for x, loss in self.losses_combined.items()]
290 288
             heapq.heapify(quals)
291 289
 
292 290
             for point_number in range(n):