0

Looking at the example from GrandStack movies workshop https://github.com/grand-stack/grand-stack-movies-workshop/blob/master/neo4j-database/answers.md

The query proposed for recommended movies here

MATCH (m:Movie) WHERE m.movieId = $movieId
MATCH (m)-[:IN_GENRE]->(g:Genre)<-[:IN_GENRE]-(movie:Movie)
WITH m, movie, COUNT(*) AS genreOverlap
MATCH (m)<-[:RATED]-(:User)-[:RATED]->(movie:Movie)
WITH movie,genreOverlap, COUNT(*) AS userRatedScore
RETURN movie ORDER BY (0.9 * genreOverlap) + (0.1 * userRatedScore)  DESC LIMIT 3

Wouldnt this query be biased in the sense that it will only calculate userRatedScore for movies that share at least one genre with the movie with Id $movieId?

How would a rewritten query look that computes both scores independently, meaning it would still calculate userRatedScore for a given movie even if it does not share genres with the movie with Id $movieId

1 Answers1

0

If you'd like to ignore the weighting provided by Genre, then you could drop the part of the query that seeks it, something like:

MATCH (m:Movie) WHERE m.movieId = $movieId, (m)<-[:RATED]-(:User)-[:RATED]->(movie:Movie)
WITH movie, COUNT(*) AS userRatedScore
RETURN movie ORDER BY (0.1 * userRatedScore)  DESC LIMIT 3
Lju
  • 582
  • 2
  • 6