MCPcopy Create free account
hub / github.com/Kaggle/docker-python / test_optimize

Method test_optimize

tests/test_bayes_opt.py:7–22  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5
6class TestBayesOpt(unittest.TestCase):
7 def test_optimize(self):
8 # Bounded region of parameter space
9 pbounds = {'x': (2, 4), 'y': (-3, 3)}
10
11 optimizer = BayesianOptimization(
12 f=black_box_function,
13 pbounds=pbounds,
14 random_state=1,
15 )
16
17 optimizer.maximize(
18 init_points=2,
19 n_iter=1,
20 )
21
22 self.assertAlmostEqual(-7, optimizer.max['target'], places=0) # compares using 0 decimal
23
24
25def black_box_function(x, y):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected