we are now going to use this binary matrix to make predictions of movie ratings the general algorithm will be (in pseudocodeas follows for each userrank every other user in terms of closeness for this stepwe will use the binary matrix and use correlation as the measure of closeness (interpreting the binary matrix as zeros and ones allows us to perform this computation when we need to estimate rating for user-movie pairwe look at the neighbors of the user sequentially (as defined in step when we first find rating for the movie in questionwe report it implementing the code firstwe are going to write simple numpy function numpy ships with np corrcoeffwhich computes correlations this is very generic function and computes -dimensional correlations even when only singletraditional correlation is needed thereforeto compute the correlation between two userswe need to call the followingcorr_between_user _and_user np corrcoef(user user )[ , in factwe will be wishing to compute the correlation between user and all the other users this will be an operation we will use few timesso we wrap it in function named all_correlationsimport numpy as np def all_correlations(baittarget)''corrs all_correlations(baittargetcorrs[iis the correlation between bait and target[ ''return np array[np corrcoef(baitc)[ , for in target]