From e11989bd78b07cef3663e42b12da7dc8dedcdb5c Mon Sep 17 00:00:00 2001 From: udlbook <110402648+udlbook@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:07:40 -0500 Subject: [PATCH] Fixed ambiguity of variable name. --- Notebooks/Chap15/15_2_Wasserstein_Distance.ipynb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Notebooks/Chap15/15_2_Wasserstein_Distance.ipynb b/Notebooks/Chap15/15_2_Wasserstein_Distance.ipynb index 10037b0..b0561b6 100644 --- a/Notebooks/Chap15/15_2_Wasserstein_Distance.ipynb +++ b/Notebooks/Chap15/15_2_Wasserstein_Distance.ipynb @@ -4,7 +4,6 @@ "metadata": { "colab": { "provenance": [], - "authorship_tag": "ABX9TyNyLnpoXgKN+RGCuTUszCAZ", "include_colab_link": true }, "kernelspec": { @@ -153,9 +152,9 @@ "cell_type": "code", "source": [ "# TODO: Now construct the matrix A that has the initial distribution constraints\n", - "# so that Ap=b where p is the transport plan P vectorized rows first so p = np.flatten(P)\n", + "# so that A @ TPFlat=b where TPFlat is the transport plan TP vectorized rows first so TPFlat = np.flatten(TP)\n", "# Replace this line:\n", - "A = np.zeros((20,100))\n" + "A = np.zeros((20,100))" ], "metadata": { "id": "7KrybL96IuNW" @@ -197,8 +196,8 @@ { "cell_type": "code", "source": [ - "P = np.array(opt.x).reshape(10,10)\n", - "draw_2D_heatmap(P,'Transport plan $\\mathbf{P}$', my_colormap)" + "TP = np.array(opt.x).reshape(10,10)\n", + "draw_2D_heatmap(TP,'Transport plan $\\mathbf{P}$', my_colormap)" ], "metadata": { "id": "nZGfkrbRV_D0" @@ -218,7 +217,7 @@ { "cell_type": "code", "source": [ - "was = np.sum(P * dist_mat)\n", + "was = np.sum(TP * dist_mat)\n", "print(\"Wasserstein distance = \", was)" ], "metadata": {