I am using Neo4J to process a data set having users and their rankings for movies. I have two node types - movies and users and a single relationship giving the rank of the user to a movie.
My goal is to explore the prediction ability for a user based on the similarity between him/her and other users.
To do that I would like to calculate similarity between users as the normalized sum of rankings for movies they both viewed. This information should then be stored in a relationship between the users.
I have the following Cypher query work for two particular nodes:
MATCH (a)-[r1:RANKS]->(m), (b)-[r2:RANKS]->(m) where a.ID<>b.ID return a.ID,b.ID, sum(abs(r1.Rate-r2.Rate))/count(m)
I would like to use this query to also create a relationship but as soon as I try the following:
MATCH (a)-[r1:RATES]->(m)<-[r2:RATES]-(b) where a.ID<>b.ID and a.ID="u_1" and b.ID="u_753" CREATE a-[:SIMILARITY_RANK{Similarity:(abs(r1.Rank-r2.Rank))/count(m)}]->(b)
I get the error message that I am using the count function in the wrong context. What am I doing wrong?
Dotan