Browse code

2D: do not wrap the function for normalization

Bas Nijholt authored on 13/10/2017 15:39:47
Showing 1 changed files
... ...
@@ -675,7 +675,7 @@ class Learner2D(BaseLearner):
675 675
 
676 676
         self.x_scale = self.bounds[0][1] - self.bounds[0][0]
677 677
         self.y_scale = self.bounds[1][1] - self.bounds[1][0]
678
-        self.xy_scale = hypot(self.x_scale, self.y_scale)
678
+        self.xy_scale = np.array([self.x_scale, self.y_scale])
679 679
 
680 680
         # Keeps track till which index _points and _values are filled
681 681
         self.n = 0
... ...
@@ -683,19 +683,9 @@ class Learner2D(BaseLearner):
683 683
         self._bounds_points = list(itertools.product(*bounds))
684 684
 
685 685
         # Add the loss improvement to the bounds in the stack
686
-        self._bounds_points = [(x / self.x_scale, y / self.y_scale)
687
-                               for x, y in self._bounds_points]
688 686
         self._stack = [(*p, np.inf) for p in self._bounds_points]
689 687
 
690
-        self.original_function = function
691
-
692
-        def scaled_function(xy):
693
-            x, y = xy
694
-            x *= self.x_scale
695
-            y *= self.y_scale
696
-            return self.original_function((x, y))
697
-
698
-        self.function = scaled_function
688
+        self.function = function
699 689
 
700 690
     @property
701 691
     def points_combined(self):