J'ai essayé sandbox avec neo4j. movielens, je l'ai essayé. J'ai fait une recommandation.
MATCH (m:Movie {title:"Short Circuit (1986)"})-[:GENRE]->(g:Genre)<-[:GENRE]-(other:Movie)
WITH m,
other,
COUNT(g) AS intersection,
COLLECT(g.name) AS i
MATCH (m)-[:GENRE]->(mg:Genre)
WITH m,
other,
intersection,
i,
COLLECT(mg.name) AS s1
MATCH (other)-[:GENRE]->(og:Genre)
WITH m,
other,
intersection,
i,
s1,
COLLECT(og.name) AS s2
WITH m,
other,
intersection,
s1,
s2
WITH m,
other,
intersection,
s1 + filter(x IN s2 WHERE NOT x IN s1) AS union,
s1,
s2
RETURN m.title,
other.title,
s1,
s2,
((1.0 * intersection) / SIZE(union)) AS jaccard
ORDER BY jaccard DESC
LIMIT 5
title jaccard
Cocoon: The Return (1988) 1.0
Evolution (2001) 1.0
Hot Tub Time Machine (2010) 1.0
Cocoon (1985) 1.0
Americathon (1979) 1.0
c'est tout.
Recommended Posts