Fixed ambiguity of variable name.
This commit is contained in:
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user