#概要
neo4jでsandboxやってみた。
movielens、やってみた。
レコメンドしてみた。
#ユーザーの評価してるジャンルの映画をお勧め。
MATCH (u:User {id:21})-[r:RATING]->(m:Movie)
WITH u,
avg(r.rating) AS mean
MATCH (u)-[r:RATING]->(m:Movie)-[:GENRE]->(g:Genre)
WHERE r.rating > mean
WITH u,
g,
COUNT(*) AS score
MATCH (g)<-[:GENRE]-(rec:Movie)
WHERE NOT EXISTS((u)-[:RATING]->(rec))
RETURN rec.title AS recommendation,
COLLECT(DISTINCT g.name) AS genres,
SUM(score) AS sscore
ORDER BY sscore DESC
LIMIT 5
#python実行結果
title genres score
Confessions of a Dangerous Mind (2002) ['COMEDY', 'CRIME', 'THRILLER', 'DRAMA', 'ROMANCE'] 639
Maximum Ride (2016) ['SCI-FI', 'COMEDY', 'ACTION', 'THRILLER', 'ADVENTURE', 'FANTASY'] 637
Rubber (2010) ['COMEDY', 'ACTION', 'CRIME', 'THRILLER', 'DRAMA', 'MYSTERY', 'ADVENTURE', 'WESTERN', 'HORROR', 'FILM-NOIR'] 632
Mars Needs Moms (2011) ['SCI-FI', 'COMEDY', 'ACTION', 'ADVENTURE', 'CHILDREN', 'ANIMATION', 'IMAX'] 628
Dragonheart 2: A New Beginning (2000) ['COMEDY', 'ACTION', 'THRILLER', 'DRAMA', 'ADVENTURE', 'FANTASY'] 606
以上。