Skip to content

Commit 07bf4dd

Browse files
committed
Fixed 'Toy Story' movie average calculation bug in Ex8.
The indicator matrix should be used for filtering elements instead of selecting elements.
1 parent 08ff370 commit 07bf4dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Exercise8/exercise8.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@
469469
"\n",
470470
"# From the matrix, we can compute statistics like average rating.\n",
471471
"print('Average rating for movie 1 (Toy Story): %f / 5' %\n",
472-
" np.mean(Y[0, R[0, :]]))\n",
472+
" np.mean(Y[0, R[0, :] == 1]))\n",
473473
"\n",
474474
"# We can \"visualize\" the ratings matrix by plotting it with imshow\n",
475475
"pyplot.figure(figsize=(8, 8))\n",

0 commit comments

Comments
 (0)