On this page:
https://neo4j.com/docs/graph-data-science/1.5-preview/alpha-algorithms/pearson/
In section
Section: 9.5.3.5. Specifying source and target ids
Has a code section that has a variable name that's a bit jarring but doesn't affect the correctness of the example. (I assume that the example was changed from Cuisines to Movies)
The variable personCuisines should be changed to personMovies in this code:
MATCH (p:Person), (m:Movie)
OPTIONAL MATCH (p)-[rated:RATED]->(m)
WITH {item:id(p), name: p.name, weights: collect(coalesce(rated.score, gds.util.NaN()))} AS userData
WITH collect(userData) AS personCuisines
WITH personCuisines,
[value in personCuisines WHERE value.name IN ["Praveena", "Arya"] | value.item ] AS sourceIds
CALL gds.alpha.similarity.pearson.stream({
data: personCuisines,
sourceIds: sourceIds,
topK: 1
})
YIELD item1, item2, similarity
WITH gds.util.asNode(item1) AS from, gds.util.asNode(item2) AS to, similarity
RETURN from.name AS from, to.name AS to, similarity
ORDER BY similarity DESC
Also... to be consistent with the other Movie DB, the Move Property should be Move.title instead of Movie.name .
... View more