Skip to content

Commit

Permalink
deploy: 2416c05
Browse files Browse the repository at this point in the history
  • Loading branch information
panxl committed Oct 28, 2023
1 parent dc434b6 commit 3517b6d
Show file tree
Hide file tree
Showing 24 changed files with 422 additions and 1,019 deletions.
73 changes: 37 additions & 36 deletions Lesson1_FNN.html

Large diffs are not rendered by default.

468 changes: 140 additions & 328 deletions Lesson2_GPR.html

Large diffs are not rendered by default.

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 33 additions & 26 deletions _sources/Lesson1_FNN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"mueller_brown_potential_vectorized = np.vectorize(mueller_brown_potential, otypes=[np.float32])\n",
"Z = mueller_brown_potential_vectorized(X, Y)\n",
"\n",
"# keep only low-energy points for training.\n",
"# keep only low-energy points for training\n",
"train_mask = Z < 10\n",
"X_train, Y_train, Z_train = X[train_mask], Y[train_mask], Z[train_mask]\n",
"\n",
Expand Down Expand Up @@ -126,8 +126,7 @@
"fig.update_layout(title='Mueller-Brown Potential', width=500, height=500,\n",
" scene = dict(\n",
" zaxis = dict(dtick=3, range=[-15, 15]),\n",
" camera_eye = dict(x=-1.2, y=-1.2, z=1.2)))\n",
"fig.show()"
" camera_eye = dict(x=-1.2, y=-1.2, z=1.2)))"
]
},
{
Expand All @@ -149,21 +148,23 @@
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"def plot_contour_map(X, Y, Z, title, colorscale='rainbow', levels=[-12, -8, -4, 0, 4, 8, 10], vmin=-15, vmax=10):\n",
" fig = plt.figure(figsize=(3, 2.5), dpi=150)\n",
" ct = plt.contour(X, Y, Z, levels, colors='k')\n",
" plt.clabel(ct, inline=True, fmt='%3.0f', fontsize=8)\n",
" ct = plt.contourf(X, Y, Z, levels, cmap=colorscale, extend='both', vmin=vmin, vmax=vmax)\n",
" plt.xlabel(\"x\", labelpad=-0.75)\n",
" plt.ylabel(\"y\", labelpad=2.5)\n",
" plt.tick_params(axis='both', pad=2, labelsize=8)\n",
" cbar = plt.colorbar()\n",
"def plot_contour_map(X, Y, Z, ax, title, colorscale='rainbow', levels=None):\n",
" if levels is None:\n",
" levels = [-12, -8, -4, 0, 4, 8, 10]\n",
" ct = ax.contour(X, Y, Z, levels, colors='k')\n",
" ax.clabel(ct, inline=True, fmt='%3.0f', fontsize=8)\n",
" ct = ax.contourf(X, Y, Z, levels, cmap=colorscale, extend='both', vmin=levels[0], vmax=levels[-1])\n",
" ax.set_xlabel(\"x\", labelpad=-0.75)\n",
" ax.set_ylabel(\"y\", labelpad=2.5)\n",
" ax.tick_params(axis='both', pad=2, labelsize=8)\n",
" cbar = plt.colorbar(ct)\n",
" cbar.ax.tick_params(labelsize=8)\n",
" plt.title(title, fontsize=8)\n",
" plt.tight_layout()\n",
" plt.show()\n",
" ax.set_title(title, fontsize=8)\n",
"\n",
"\n",
"plot_contour_map(X, Y, Z, 'Mueller-Brown Potential')"
"fig, ax = plt.subplots(figsize=(3, 2.5), dpi=150)\n",
"plot_contour_map(X, Y, Z, ax=ax, title='Mueller-Brown Potential')\n",
"fig.tight_layout()"
]
},
{
Expand Down Expand Up @@ -353,9 +354,11 @@
"Z_pred = model(torch.from_numpy(np.column_stack((X.flatten(), Y.flatten())))).detach().numpy().reshape(Z.shape)\n",
"Z_diff = Z_pred - Z\n",
"\n",
"plot_contour_map(X, Y, Z, title='(a) Reference')\n",
"plot_contour_map(X, Y, Z_pred, title='(b) Predicted')\n",
"plot_contour_map(X, Y, Z_diff, title='(c) Difference', levels=[-4, -2, 0, 2, 4])"
"fig, ax = plt.subplots(3, figsize=(3, 7.5), dpi=150)\n",
"plot_contour_map(X, Y, Z, ax=ax[0], title='(a) Reference')\n",
"plot_contour_map(X, Y, Z_pred, ax=ax[1], title='(b) Predicted')\n",
"plot_contour_map(X, Y, Z_diff, ax=ax[2], title='(c) Difference', levels=[-4, -2, 0, 2, 4])\n",
"fig.tight_layout()"
]
},
{
Expand Down Expand Up @@ -556,9 +559,11 @@
"Z_pred = model(torch.from_numpy(np.column_stack((X.flatten(), Y.flatten())))).detach().numpy().reshape(Z.shape)\n",
"Z_diff = Z_pred - Z\n",
"\n",
"plot_contour_map(X, Y, Z, title='(a) Reference')\n",
"plot_contour_map(X, Y, Z_pred, title='(b) Predicted')\n",
"plot_contour_map(X, Y, Z_diff, title='(c) Difference', levels=[-4, -2, 0, 2, 4])"
"fig, ax = plt.subplots(3, figsize=(3, 7.5), dpi=150)\n",
"plot_contour_map(X, Y, Z, ax=ax[0], title='(a) Reference')\n",
"plot_contour_map(X, Y, Z_pred, ax=ax[1], title='(b) Predicted')\n",
"plot_contour_map(X, Y, Z_diff, ax=ax[2], title='(c) Difference', levels=[-4, -2, 0, 2, 4])\n",
"fig.tight_layout()"
]
},
{
Expand Down Expand Up @@ -681,9 +686,11 @@
"Z_pred = model(torch.from_numpy(np.column_stack((X.flatten(), Y.flatten())))).detach().numpy().reshape(Z.shape)\n",
"Z_diff = Z_pred - Z\n",
"\n",
"plot_contour_map(X, Y, Z, title='(a) Reference')\n",
"plot_contour_map(X, Y, Z_pred, title='(b) Predicted')\n",
"plot_contour_map(X, Y, Z_diff, title='(c) Difference', levels=[-4, -2, 0, 2, 4])"
"fig, ax = plt.subplots(3, figsize=(3, 7.5), dpi=150)\n",
"plot_contour_map(X, Y, Z, ax=ax[0], title='(a) Reference')\n",
"plot_contour_map(X, Y, Z_pred, ax=ax[1], title='(b) Predicted')\n",
"plot_contour_map(X, Y, Z_diff, ax=ax[2], title='(c) Difference', levels=[-4, -2, 0, 2, 4])\n",
"fig.tight_layout()"
]
}
],
Expand All @@ -707,7 +714,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.10.13"
},
"vscode": {
"interpreter": {
Expand Down
839 changes: 211 additions & 628 deletions _sources/Lesson2_GPR.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 3517b6d

Please sign in to comment.