Skip to content

Instantly share code, notes, and snippets.

@Wann-Jiun
Last active January 21, 2017 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wann-Jiun/8e0c7169ba60be99bb7c1019bb78b8e2 to your computer and use it in GitHub Desktop.
Save Wann-Jiun/8e0c7169ba60be99bb7c1019bb78b8e2 to your computer and use it in GitHub Desktop.
similarity_user = train_matrix.dot(train_matrix.T) + 1e-9
norms = np.array([np.sqrt(np.diagonal(similarity_user))])
similarity_user = ( similarity_user / (norms * norms.T) )
similarity_movie = train_matrix.T.dot(train_matrix) + 1e-9
norms = np.array([np.sqrt(np.diagonal(similarity_movie))])
similarity_movie = ( similarity_movie / (norms * norms.T) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment