0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

neo4jでsandbox その11

Posted at

#概要

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


以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?