Skip to content

Commit 715106b

Browse files
committed
lab 2 edits
1 parent 1a64906 commit 715106b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lab2/Part2_Debiasing.ipynb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -997,23 +997,24 @@
997997
"source": [
998998
"test_faces = np.asarray(test_faces)\n",
999999
"test_faces = test_faces.reshape(20, 64, 64, 3)\n",
1000-
"logits = dbvae.predict(test_faces)\n",
10011000
"y_logit, z_mean, z_logsigma, x_recon = dbvae(test_faces)\n",
10021001
"loss, class_loss, vae_loss = debiasing_loss_function(test_faces, x_recon, tf.ones((20, 1)), y_logit, z_mean, z_logsigma)\n",
10031002
"indices = np.argsort(vae_loss, axis=None)\n",
10041003
"test_faces = test_faces[indices]\n",
1005-
"class_loss = class_loss.numpy()[indices]\n",
1004+
"vae_loss = vae_loss.numpy()[indices]\n",
10061005
"\n",
1007-
"\n",
1008-
"fig, axs = plt.subplots(1, 5)\n",
1006+
"fig, axs = plt.subplots(1, 5, constrained_layout=True)\n",
10091007
"for i in range(1, 6):\n",
10101008
" axs[i - 1].imshow(test_faces[- 1 * i])\n",
1011-
" axs[i - 1].set_title(round(vae_loss.numpy()[-1 * i], 7))\n",
1009+
" axs[i - 1].set_title(round(vae_loss[-1 * i], 7))\n",
1010+
"print(\"Samples with the highest reconstruction loss\")\n",
1011+
"plt.show()\n",
10121012
"\n",
1013-
"fig, axs = plt.subplots(1, 5)\n",
1013+
"fig, axs = plt.subplots(1, 5, constrained_layout=True)\n",
10141014
"for i in range(5):\n",
10151015
" axs[i].imshow(test_faces[i])\n",
1016-
" axs[i].set_title(round(vae_loss.numpy()[i], 7))"
1016+
" axs[i].set_title(round(vae_loss[i], 7))\n",
1017+
"print(\"Samples with the lowest reconstruction loss\")"
10171018
]
10181019
},
10191020
{

0 commit comments

Comments
 (0)