From 07bf4dd93131425888a2c816050e40ec90b94175 Mon Sep 17 00:00:00 2001 From: Maor Date: Sun, 30 Sep 2018 18:21:22 +0300 Subject: [PATCH] Fixed 'Toy Story' movie average calculation bug in Ex8. The indicator matrix should be used for filtering elements instead of selecting elements. --- Exercise8/exercise8.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercise8/exercise8.ipynb b/Exercise8/exercise8.ipynb index 3e4aa60..c47efd2 100755 --- a/Exercise8/exercise8.ipynb +++ b/Exercise8/exercise8.ipynb @@ -469,7 +469,7 @@ "\n", "# From the matrix, we can compute statistics like average rating.\n", "print('Average rating for movie 1 (Toy Story): %f / 5' %\n", - " np.mean(Y[0, R[0, :]]))\n", + " np.mean(Y[0, R[0, :] == 1]))\n", "\n", "# We can \"visualize\" the ratings matrix by plotting it with imshow\n", "pyplot.figure(figsize=(8, 8))\n",