Hadryan / movies4j

Sample movie recommendation application for Neo4j and Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Movies4j - Movie Recommendation Engine

Movies4j is an example application for the usage of Graph Databases, specifically of Neo4j. It is targeted at beginners who want to learn about the benefits of Graph Databases and their use cases. It shows the simplicity of the Neo4j and the Cypher Query Language. If you are interested, learn more about them on neo4j.com.

The application allows users to rate movies they like and add other users as their friends. Based on this information, users will receive recommendations for other movies, they might like as well and movies that their friends like.

Screenshot

Architecture

Installation

  • Download Neo4j Community Edition from http://neo4j.com/ (Manual)
  • Unzip the contents of db/graph.db.zip to neo-install-dir/data/graph.db
  • Start Neo4j ./bin/neo4j start
  • Open your browser at http://localhost:7474, login with neo4j/neo4j and change the password to neo5j (feel free to use a different password, but then you need to change the connection url in config.js accordingly)
  • Run npm install in the repo's main directory
  • Run npm start to start the server
  • Open your browser at http://localhost:8000

##Algorithms Probably one of the most interesting parts of the application are the algorithms that are used to determine recommendations. You can have a look at them in models/user.js (getSimilarMovies and getFriendsMovies are the important methods).

###Similar Movies

MATCH (me:User)-[r1:RATED]->(m:Movie)<-[r2:RATED]-(u:User)-[r3:RATED]->(m2:Movie)
WHERE ID(me) = {userid} AND r1.stars > 3 AND r2.stars > 3 AND r3.stars > 3 AND NOT (me)-[:RATED]->(m2)
RETURN distinct m2 AS movie, count(*) AS count
ORDER BY count DESC
LIMIT 10

Explanation: Look for users who rated movies with three or more stars, that I have rated high as well. Which movies did these users liked additionally and I haven't seen yet?

###Friends Movies

MATCH (me:User)-[:FRIEND]-(f), (f)-[r:RATED]-(m:Movie)
WHERE ID(me) = {userid} AND r.stars > 3 AND NOT (me)-[:RATED]->(m)
RETURN distinct m AS movie, count(*) AS count
ORDER BY count DESC
LIMIT 10

Explanation: From all of my friends, which movies did they rated high and I haven't seen yet?

About

Sample movie recommendation application for Neo4j and Node.js.


Languages

Language:JavaScript 75.4%Language:HTML 23.9%Language:CSS 0.8%