#概要
neo4jでsandboxやってみた。
movielens、やってみた。
レコメンドしてみた。
#jaccardで映画をお勧め。
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
#python実行結果
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
以上。