Created
July 14, 2020 15:48
-
-
Save LeonardoMarrancone/3ad97000a2e7a32c67cb152064f2d856 to your computer and use it in GitHub Desktop.
Cosine similiraty with GDSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (p1:User {name: 'Leonardo', surname:"Marrancone"})-[x:WATCH]->(movie)<-[y:WATCH]-(p2:User) | |
WHERE p2 <> p1 | |
WITH p1, p2, collect(x.rating) AS p1Ratings, collect(y.rating) AS p2Ratings | |
RETURN p1.name AS SelectedUser, | |
p2.name AS SimilarUser, | |
gds.alpha.similarity.cosine(p1Ratings, p2Ratings) AS sim | |
ORDER BY sim DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment