|
16 | 16 | "source": [ |
17 | 17 | "## Introduction\n", |
18 | 18 | "\n", |
19 | | - "Bayesian optimization is particularly useful for expensive optimization problems. This includes optimization problems where the objective (and constraints) are time-consuming to evaluate: measurements, engineering simulations, cross-hyperparameter optimization of deep learning models, etc. Another area where Bayesian optimization may provide a benefit is in the presence of (a lot of) noise.\n", |
| 19 | + "Bayesian optimization is particularly useful for expensive optimization problems. This includes optimization problems where the objective (and constraints) are time-consuming to evaluate: measurements, engineering simulations, hyperparameter optimization of deep learning models, etc. Another area where Bayesian optimization may provide a benefit is in the presence of (a lot of) noise. If your problem does not satisfy these requirements other optimization algorithms might be better suited.\n", |
20 | 20 | "\n", |
21 | | - "If your problem does not satisfy these requirements other optimization algorithms might be better suited.\n", |
22 | | - "\n", |
23 | | - "To setup a basic Bayesian optimization you have to:\n", |
| 21 | + "To setup a Bayesian optimization scheme with GPflowOpt you have to:\n", |
24 | 22 | "\n", |
25 | 23 | "- define your objective and specify the optimization domain\n", |
26 | 24 | "- setup a GPflow model and choose an acquisition function\n", |
|
45 | 43 | "<table id='domain' width=100%><tr><td>Name</td><td>Type</td><td>Values</td></tr><tr><td>x1</td><td>Continuous</td><td>[-2. 2.]</td></tr><tr><td>x2</td><td>Continuous</td><td>[-1. 2.]</td></tr></table>" |
46 | 44 | ], |
47 | 45 | "text/plain": [ |
48 | | - "<GPflowOpt.domain.Domain at 0x21ea69589b0>" |
| 46 | + "<GPflowOpt.domain.Domain at 0x7f1f613eef60>" |
49 | 47 | ] |
50 | 48 | }, |
51 | 49 | "execution_count": 1, |
|
60 | 58 | "\n", |
61 | 59 | "def fx(X):\n", |
62 | 60 | " X = np.atleast_2d(X)\n", |
63 | | - " # Return objective & gradient\n", |
64 | 61 | " return np.sum(np.square(X), axis=1)[:, None]\n", |
65 | 62 | "\n", |
66 | 63 | "domain = ContinuousParameter('x1', -2, 2) + ContinuousParameter('x2', -1, 2)\n", |
|
83 | 80 | "name": "stdout", |
84 | 81 | "output_type": "stream", |
85 | 82 | "text": [ |
86 | | - "Warning: optimization restart 5/5 failed\n", |
87 | | - " fun: array([ 1.69219493e-05])\n", |
| 83 | + "Warning: optimization restart 1/5 failed\n", |
| 84 | + "Warning: optimization restart 2/5 failed\n", |
| 85 | + "Warning: optimization restart 3/5 failed\n", |
| 86 | + "Warning: optimization restart 2/5 failed\n", |
| 87 | + " fun: array([ 0.01])\n", |
88 | 88 | " message: 'OK'\n", |
89 | 89 | " nfev: 15\n", |
90 | 90 | " success: True\n", |
91 | | - " x: array([[ -9.60370839e-05, 4.11250850e-03]])\n" |
| 91 | + " x: array([[ 0. , -0.1]])\n" |
92 | 92 | ] |
93 | 93 | } |
94 | 94 | ], |
|
104 | 104 | "X = lhd.generate()\n", |
105 | 105 | "Y = fx(X)\n", |
106 | 106 | "model = GPflow.gpr.GPR(X, Y, GPflow.kernels.Matern52(2, ARD=True))\n", |
| 107 | + "model.kern.lengthscales.transform = GPflow.transforms.Log1pe(1e-3)\n", |
107 | 108 | "\n", |
108 | 109 | "# Now create the Bayesian Optimizer\n", |
109 | 110 | "alpha = ExpectedImprovement(model)\n", |
|
119 | 120 | "cell_type": "markdown", |
120 | 121 | "metadata": {}, |
121 | 122 | "source": [ |
122 | | - "That's all! Your objective function has now been optimized over 15 iterations." |
| 123 | + "That's all! Your objective function has now been optimized for 15 iterations." |
123 | 124 | ] |
124 | 125 | } |
125 | 126 | ], |
|
0 commit comments