Skip to content

Commit

Permalink
Update optimisation.ipynb
Browse files Browse the repository at this point in the history
Update mace-->hebo
  • Loading branch information
Alexander Cowen-Rivers authored Jan 17, 2022
1 parent d8a6325 commit f249ee6
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions HEBO/doc/source/optimisation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
"\n",
"We compare three BO algorithms:\n",
"- The basic BO with LCB acquisition\n",
"- MACE where three acquisition functions are ensembled, with input warping and power transformation\n",
"- MACE with parallel recommendation\n",
"- HEBO where three acquisition functions are ensembled, with input warping and power transformation\n",
"- HEBO with parallel recommendation\n",
"\n",
"We'll run BO with LCB firstly, we can see the interface is very simple"
]
Expand Down Expand Up @@ -187,7 +187,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We then run the sequential MACE"
"We then run the sequential HEBO"
]
},
{
Expand Down Expand Up @@ -219,12 +219,12 @@
}
],
"source": [
"mace_seq = HEBO(space, model_name = 'gpy', rand_sample = 4)\n",
"hebo_seq = HEBO(space, model_name = 'gpy', rand_sample = 4)\n",
"for i in range(64):\n",
" rec_x = mace_seq.suggest(n_suggestions=1)\n",
" mace_seq.observe(rec_x, obj(rec_x))\n",
" rec_x = hebo_seq.suggest(n_suggestions=1)\n",
" hebo_seq.observe(rec_x, obj(rec_x))\n",
" if i % 4 == 0:\n",
" print('Iter %d, best_y = %.2f' % (i, mace_seq.y.min()))"
" print('Iter %d, best_y = %.2f' % (i, hebo_seq.y.min()))"
]
},
{
Expand Down Expand Up @@ -263,11 +263,11 @@
}
],
"source": [
"mace_batch = HEBO(space, model_name = 'gpy', rand_sample = 4)\n",
"hebo_batch = HEBO(space, model_name = 'gpy', rand_sample = 4)\n",
"for i in range(16):\n",
" rec_x = mace_batch.suggest(n_suggestions=8)\n",
" mace_batch.observe(rec_x, obj(rec_x))\n",
" print('Iter %d, best_y = %.2f' % (i, mace_batch.y.min()))"
" rec_x = hebo_batch.suggest(n_suggestions=8)\n",
" hebo_batch.observe(rec_x, obj(rec_x))\n",
" print('Iter %d, best_y = %.2f' % (i, hebo_batch.y.min()))"
]
},
{
Expand All @@ -276,16 +276,16 @@
"metadata": {},
"outputs": [],
"source": [
"conv_mace_batch = np.minimum.accumulate(mace_batch.y)\n",
"conv_mace_seq = np.minimum.accumulate(mace_seq.y)\n",
"conv_hebo_batch = np.minimum.accumulate(hebo_batch.y)\n",
"conv_hebo_seq = np.minimum.accumulate(hebo_seq.y)\n",
"conv_bo_seq = np.minimum.accumulate(bo.y)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We plot the converge below, we can see it seems that the LCB converges slightly faster than MACE, while batched MACE used most function evaluations"
"We plot the converge below, we can see it seems that the LCB converges slightly faster than HEBO, while batched HEBO used most function evaluations"
]
},
{
Expand Down Expand Up @@ -318,8 +318,8 @@
],
"source": [
"plt.figure(figsize = (8,6))\n",
"plt.semilogy(conv_mace_batch - problem.ideal_point(), 'x-',label = 'MACE, Parallel,Batch = 8')\n",
"plt.semilogy(conv_mace_seq - problem.ideal_point(), 'x-',label = 'MACE, Sequential')\n",
"plt.semilogy(conv_hebo_batch - problem.ideal_point(), 'x-',label = 'HEBO, Parallel,Batch = 8')\n",
"plt.semilogy(conv_hebo_seq - problem.ideal_point(), 'x-',label = 'HEBO, Sequential')\n",
"plt.semilogy(conv_bo_seq - problem.ideal_point(), 'x-',label = 'BO, LCB')\n",
"\n",
"plt.xlabel('Evaluation')\n",
Expand All @@ -331,7 +331,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Batched MACE used most function evaluations because it recommend eight points per iterations, we can also plot the converge against **iterations** instead of **evaluations**"
"Batched HEBO used most function evaluations because it recommend eight points per iterations, we can also plot the converge against **iterations** instead of **evaluations**"
]
},
{
Expand Down Expand Up @@ -364,8 +364,8 @@
],
"source": [
"plt.figure(figsize = (8,6))\n",
"plt.semilogy(conv_mace_batch[::8] - problem.ideal_point(), 'x-',label = 'MACE, Parallel,Batch = 8')\n",
"plt.semilogy(conv_mace_seq - problem.ideal_point(), 'x-',label = 'MACE, Sequential')\n",
"plt.semilogy(conv_hebo_batch[::8] - problem.ideal_point(), 'x-',label = 'HEBO, Parallel,Batch = 8')\n",
"plt.semilogy(conv_hebo_seq - problem.ideal_point(), 'x-',label = 'HEBO, Sequential')\n",
"plt.semilogy(conv_bo_seq - problem.ideal_point(), 'x-',label = 'BO, LCB')\n",
"\n",
"plt.xlabel('Iterations')\n",
Expand All @@ -377,7 +377,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can see that parallel MACE converges much faster"
"We can see that parallel HEBO converges much faster"
]
}
],
Expand Down

0 comments on commit f249ee6

Please sign in to comment.