Example #1
0
 def test_select_point_to_explore_in_two_dimensions(self):
     '''
     This test case just runs code on a multi-dimensional input dataset.
     It doesn't test any conditions, but could presumably do so in the future.
     '''
     acquire(
         x=a([
             [-0.5, -0.5],
             [-0.5, 0.5],
         ]),
         # Fake fmap and Cmap values from another set of x's
         fmap=a([
             [0.03254087],
             [-0.03254087],
         ]),
         Cmap=a([
             [0.07894662, -0.07894662],
             [-0.07894662, 0.07894662],
         ]),
         bounds=a([
             [-1.0, 1.0],
             [-1.0, 1.0],
         ]),
         kernelfunc=default_kernel
     )
Example #2
0
 def test_select_point_to_exploit(self):
     # We attempt to force exploitation by covering most of the input
     # space and expecting that the maximization algorithm will choose
     # the point between the highest outputs, given a symmetric output function.
     next_point = acquire(
         x=a([
             [-0.75],
             [-0.25],
             [0.25],
             [0.75],
         ]),
         # I got these fmap and Cmap values from running our optimizer
         # on the input data with comparisons [1, 0], [1, 3], [2, 0], [2, 3].
         fmap=a([
             [0.08950024],
             [0.21423927],
             [0.21423927],
             [0.08950024],
         ]),
         Cmap=a([
             [0.15672336, -0.07836168, -0.07836168, 0.0],
             [-0.07836168, 0.15672336, 0.0, -0.07836168],
             [-0.07836168, 0.0, 0.15672336, -0.07836168],
             [0.0, -0.07836168, -0.07836168, 0.15672336],
         ]),
         bounds=a([
             [-1.0, 1.0],
         ]),
         kernelfunc=default_kernel
     )
     self.assertTrue(next_point[0] > -.25)
     self.assertTrue(next_point[0] < .25)
Example #3
0
 def test_select_point_to_explore(self):
     next_point = acquire(
         x=a([
             [-0.75],
             [-0.4],
         ]),
         # I got these fmap and Cmap values from running our optimizer
         # on the input data with comparisons [0, 1]
         fmap=a([
             [0.03254087],
             [-0.03254087],
         ]),
         Cmap=a([
             [0.07894662, -0.07894662],
             [-0.07894662, 0.07894662],
         ]),
         bounds=a([
             [-1.0, 1.0],
         ]),
         kernelfunc=default_kernel
     )
     self.assertTrue(next_point[0] > -.4)