Skip to content

Commit 3b6d8aa

Browse files
Balandatfacebook-github-bot
authored andcommitted
Update tutorials, log in debug mode on failure during fitting. (#195)
Summary: - Update tutorials (rerun code, fix some matplotlib DeprecationErrors) - log on `logging.DEBUG` level instead of warning during model fitting Pull Request resolved: #195 Reviewed By: danielrjiang Differential Revision: D16038783 Pulled By: Balandat fbshipit-source-id: 8bc11fcfe5efac2bc26e0af266f6f1715c381291
1 parent 9bc05e1 commit 3b6d8aa

11 files changed

+68
-97
lines changed

botorch/fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def fit_gpytorch_model(
100100
mll.eval()
101101
return mll
102102
retry += 1
103-
logging.warning(f"Fitting failed on try {retry}.")
103+
logging.log(logging.DEBUG, f"Fitting failed on try {retry}.")
104104

105105
warnings.warn("Fitting failed on all retries.", OptimizationWarning)
106106
return mll.eval()

tutorials/batch_mode_cross_validation.ipynb

Lines changed: 8 additions & 28 deletions
Large diffs are not rendered by default.

tutorials/closed_loop_botorch_only.ipynb

Lines changed: 4 additions & 5 deletions
Large diffs are not rendered by default.

tutorials/compare_mc_analytic_acquisition.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
{
103103
"data": {
104104
"text/plain": [
105-
"tensor([[0.3050, 0.2956, 0.3007, 0.2611, 0.3353, 0.4999]])"
105+
"tensor([[0.2553, 0.4734, 0.1621, 0.3114, 0.3896, 0.1460]])"
106106
]
107107
},
108108
"execution_count": 5,
@@ -154,7 +154,7 @@
154154
{
155155
"data": {
156156
"text/plain": [
157-
"tensor([[0.3051, 0.2951, 0.3009, 0.2609, 0.3354, 0.5003]])"
157+
"tensor([[0.2553, 0.4736, 0.1621, 0.3114, 0.3897, 0.1460]])"
158158
]
159159
},
160160
"execution_count": 7,
@@ -181,7 +181,7 @@
181181
{
182182
"data": {
183183
"text/plain": [
184-
"tensor(0.0007)"
184+
"tensor(0.0002)"
185185
]
186186
},
187187
"execution_count": 8,
@@ -245,7 +245,7 @@
245245
{
246246
"data": {
247247
"text/plain": [
248-
"tensor([[0.3051, 0.2950, 0.3008, 0.2609, 0.3358, 0.5008]])"
248+
"tensor([[0.2553, 0.4731, 0.1623, 0.3106, 0.3893, 0.1455]])"
249249
]
250250
},
251251
"execution_count": 10,
@@ -265,7 +265,7 @@
265265
{
266266
"data": {
267267
"text/plain": [
268-
"tensor(0.0013)"
268+
"tensor(0.0010)"
269269
]
270270
},
271271
"execution_count": 11,
@@ -312,7 +312,7 @@
312312
{
313313
"data": {
314314
"text/plain": [
315-
"tensor([[0.3049, 0.2957, 0.3006, 0.2611, 0.3352, 0.4998]])"
315+
"tensor([[0.2566, 0.4745, 0.1638, 0.3110, 0.3896, 0.1485]])"
316316
]
317317
},
318318
"execution_count": 13,
@@ -332,7 +332,7 @@
332332
{
333333
"data": {
334334
"text/plain": [
335-
"tensor(0.0001)"
335+
"tensor(0.0035)"
336336
]
337337
},
338338
"execution_count": 14,
@@ -361,7 +361,7 @@
361361
"name": "python",
362362
"nbconvert_exporter": "python",
363363
"pygments_lexer": "ipython3",
364-
"version": "3.7.1"
364+
"version": "3.7.3"
365365
}
366366
},
367367
"nbformat": 4,

tutorials/custom_acquisition.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
{
133133
"data": {
134134
"text/plain": [
135-
"tensor([0.4976], grad_fn=<MeanBackward2>)"
135+
"tensor([0.4938], grad_fn=<MeanBackward2>)"
136136
]
137137
},
138138
"execution_count": 3,
@@ -155,7 +155,7 @@
155155
{
156156
"data": {
157157
"text/plain": [
158-
"tensor([0.4818, 0.5486], grad_fn=<MeanBackward2>)"
158+
"tensor([0.5833, 0.5478], grad_fn=<MeanBackward2>)"
159159
]
160160
},
161161
"execution_count": 4,
@@ -259,7 +259,7 @@
259259
{
260260
"data": {
261261
"text/plain": [
262-
"tensor([0.4793], grad_fn=<AddBackward0>)"
262+
"tensor([0.3583], grad_fn=<AddBackward0>)"
263263
]
264264
},
265265
"execution_count": 7,
@@ -280,7 +280,7 @@
280280
{
281281
"data": {
282282
"text/plain": [
283-
"tensor([0.3744, 0.4234, 0.4092], grad_fn=<AddBackward0>)"
283+
"tensor([0.3743, 0.5131, 0.3595], grad_fn=<AddBackward0>)"
284284
]
285285
},
286286
"execution_count": 8,
@@ -348,7 +348,7 @@
348348
"name": "python",
349349
"nbconvert_exporter": "python",
350350
"pygments_lexer": "ipython3",
351-
"version": "3.7.1"
351+
"version": "3.7.3"
352352
}
353353
},
354354
"nbformat": 4,

tutorials/custom_botorch_model_in_ax.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
"name": "python",
290290
"nbconvert_exporter": "python",
291291
"pygments_lexer": "ipython3",
292-
"version": "3.7.1"
292+
"version": "3.7.3"
293293
}
294294
},
295295
"nbformat": 4,

tutorials/fit_model_with_torch_optimizer.ipynb

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

tutorials/meta_learning_with_rgpe.ipynb

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

tutorials/optimize_stochastic.ipynb

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
{
3939
"cell_type": "code",
4040
"execution_count": 2,
41-
"metadata": {
42-
"collapsed": true
43-
},
41+
"metadata": {},
4442
"outputs": [],
4543
"source": [
4644
"d = 5\n",
@@ -67,9 +65,7 @@
6765
{
6866
"cell_type": "code",
6967
"execution_count": 3,
70-
"metadata": {
71-
"collapsed": true
72-
},
68+
"metadata": {},
7369
"outputs": [],
7470
"source": [
7571
"from botorch.acquisition import qExpectedImprovement\n",
@@ -91,9 +87,7 @@
9187
{
9288
"cell_type": "code",
9389
"execution_count": 4,
94-
"metadata": {
95-
"collapsed": true
96-
},
90+
"metadata": {},
9791
"outputs": [],
9892
"source": [
9993
"N = 5\n",
@@ -119,10 +113,8 @@
119113
},
120114
{
121115
"cell_type": "code",
122-
"execution_count": 8,
123-
"metadata": {
124-
"collapsed": true
125-
},
116+
"execution_count": 5,
117+
"metadata": {},
126118
"outputs": [],
127119
"source": [
128120
"from botorch.optim.initializers import initialize_q_batch_nonneg\n",
@@ -157,18 +149,18 @@
157149
},
158150
{
159151
"cell_type": "code",
160-
"execution_count": 9,
152+
"execution_count": 6,
161153
"metadata": {},
162154
"outputs": [
163155
{
164156
"name": "stdout",
165157
"output_type": "stream",
166158
"text": [
167-
"Iteration 15/75 - Loss: -0.222\n",
168-
"Iteration 30/75 - Loss: -0.283\n",
169-
"Iteration 45/75 - Loss: -0.561\n",
170-
"Iteration 60/75 - Loss: -0.730\n",
171-
"Iteration 75/75 - Loss: -0.756\n"
159+
"Iteration 15/75 - Loss: -0.346\n",
160+
"Iteration 30/75 - Loss: -0.574\n",
161+
"Iteration 45/75 - Loss: -0.610\n",
162+
"Iteration 60/75 - Loss: -0.642\n",
163+
"Iteration 75/75 - Loss: -0.623\n"
172164
]
173165
}
174166
],
@@ -217,7 +209,7 @@
217209
"name": "python",
218210
"nbconvert_exporter": "python",
219211
"pygments_lexer": "ipython3",
220-
"version": "3.7.1"
212+
"version": "3.7.3"
221213
}
222214
},
223215
"nbformat": 4,

tutorials/optimize_with_cmaes.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
{
2626
"cell_type": "code",
27-
"execution_count": 9,
27+
"execution_count": 1,
2828
"metadata": {},
2929
"outputs": [],
3030
"source": [
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"cell_type": "code",
49-
"execution_count": 10,
49+
"execution_count": 2,
5050
"metadata": {},
5151
"outputs": [],
5252
"source": [
@@ -72,23 +72,23 @@
7272
},
7373
{
7474
"cell_type": "code",
75-
"execution_count": 12,
75+
"execution_count": 3,
7676
"metadata": {},
7777
"outputs": [
7878
{
7979
"name": "stdout",
8080
"output_type": "stream",
8181
"text": [
82-
"(25_w,50)-aCMA-ES (mu_w=14.0,w_1=14%) in dimension 2 (seed=626882, Mon Apr 29 15:20:24 2019)\n"
82+
"(25_w,50)-aCMA-ES (mu_w=14.0,w_1=14%) in dimension 2 (seed=760451, Thu Jun 27 13:24:05 2019)\n"
8383
]
8484
},
8585
{
8686
"data": {
8787
"text/plain": [
88-
"tensor([2.7329e-01, 9.6251e-08])"
88+
"tensor([1.9858e-01, 3.1043e-07])"
8989
]
9090
},
91-
"execution_count": 12,
91+
"execution_count": 3,
9292
"metadata": {},
9393
"output_type": "execute_result"
9494
}
@@ -145,7 +145,7 @@
145145
"name": "python",
146146
"nbconvert_exporter": "python",
147147
"pygments_lexer": "ipython3",
148-
"version": "3.7.1"
148+
"version": "3.7.3"
149149
}
150150
},
151151
"nbformat": 4,

0 commit comments

Comments
 (0)