Skip to content

Commit

Permalink
Merge pull request #60 from ziatdinovmax/mc-dev-notebooks
Browse files Browse the repository at this point in the history
Notebook rework for smoke tests
  • Loading branch information
ziatdinovmax authored Oct 23, 2023
2 parents 83c0113 + 80853eb commit 77e1bf6
Show file tree
Hide file tree
Showing 8 changed files with 4,211 additions and 9,297 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/notebook_smoke.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: notebooks


env:
CI_SMOKE: True

on:
pull_request:
branches:
Expand Down
1,850 changes: 691 additions & 1,159 deletions examples/GP_sGP.ipynb

Large diffs are not rendered by default.

2,992 changes: 1,025 additions & 1,967 deletions examples/GPax_MultiTaskGP_BO.ipynb

Large diffs are not rendered by default.

57 changes: 48 additions & 9 deletions examples/compare_GPs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"\n",
"This is a simple notebook to compare timings and results of two different commonly used GPs. One trained using NUTS, and the other trained using SVI.\n",
"\n",
"*Prepared by Matthew R. Carbone & Maxim Ziatdinov (2023)*"
"*Prepared by Matthew R. Carbone & Maxim Ziatdinov (2023). Last updated in October 2023.*"
]
},
{
Expand Down Expand Up @@ -66,7 +66,7 @@
"id": "86iUwKxLO7qE"
},
"source": [
"Install GPax package:"
"Install the latest GPax package from PyPI (this is best practice, as it installs the latest, deployed and tested version). Please do not install from a GitHub url!"
]
},
{
Expand Down Expand Up @@ -125,6 +125,37 @@
"gpax.utils.enable_x64() # enable double precision"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Enable some pretty plotting."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib as mpl"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mpl.rcParams['mathtext.fontset'] = 'stix'\n",
"mpl.rcParams['font.family'] = 'STIXGeneral'\n",
"mpl.rcParams['text.usetex'] = False\n",
"plt.rc('xtick', labelsize=12)\n",
"plt.rc('ytick', labelsize=12)\n",
"plt.rc('axes', labelsize=12)\n",
"mpl.rcParams['figure.dpi'] = 200"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down Expand Up @@ -168,11 +199,12 @@
"y = f(X) + np.random.normal(0., NOISE_LEVEL, NUM_INIT_POINTS)\n",
"\n",
"# Plot generated data\n",
"plt.figure(dpi=100)\n",
"plt.xlabel(\"$x$\")\n",
"plt.ylabel(\"$y$\")\n",
"plt.scatter(X, y, marker='x', c='k', zorder=1, label='Noisy observations')\n",
"plt.ylim(-1.8, 2.2);"
"fig, ax = plt.subplots(1, 1, figsize=(6, 2))\n",
"ax.set_xlabel(\"$x$\")\n",
"ax.set_ylabel(\"$y$\")\n",
"ax.scatter(X, y, marker='x', c='k', zorder=1, label='Noisy observations')\n",
"ax.set_ylim(-1.8, 2.2)\n",
"plt.show()"
]
},
{
Expand Down Expand Up @@ -271,7 +303,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that SVI (the `viGP`) is significantly faster. SVI is usually better to use on larger datasets and is more easily scalable. In this case, they produce similar results."
"Note that SVI (the `viGP`) is significantly faster (use the `% timeit` magic before the command to see). SVI is usually better to use on larger datasets and is more easily scalable. In this case, they produce similar results."
]
},
{
Expand Down Expand Up @@ -314,7 +346,7 @@
},
"outputs": [],
"source": [
"_, ax = plt.subplots(1, 1, figsize=(6, 2), dpi=200)\n",
"_, ax = plt.subplots(1, 1, figsize=(6, 2))\n",
"\n",
"ax.set_xlabel(\"$x$\")\n",
"ax.set_ylabel(\"$y$\")\n",
Expand All @@ -339,6 +371,13 @@
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
965 changes: 406 additions & 559 deletions examples/gpax_GPBO.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 77e1bf6

Please sign in to comment.