Fixed 'Toy Story' movie average calculation bug in Ex8.

The indicator matrix should be used for filtering elements instead of selecting elements.
This commit is contained in:
Maor
2018-09-30 18:21:22 +03:00
parent 08ff370008
commit 07bf4dd931

View File

@@ -469,7 +469,7 @@
"\n", "\n",
"# From the matrix, we can compute statistics like average rating.\n", "# From the matrix, we can compute statistics like average rating.\n",
"print('Average rating for movie 1 (Toy Story): %f / 5' %\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", "\n",
"# We can \"visualize\" the ratings matrix by plotting it with imshow\n", "# We can \"visualize\" the ratings matrix by plotting it with imshow\n",
"pyplot.figure(figsize=(8, 8))\n", "pyplot.figure(figsize=(8, 8))\n",