/recommendations

Neo4j Graph Example Movies Recommendation

Primary LanguageJavaScript

icon movie

Recommendations Graph Example

Description: Generate personalized real-time recommendations using a dataset of movie reviews

Nodes 28863 Relationships 166261

model
Figure 1. Model
example
Figure 2. Example
Example Query:
MATCH (m:Movie {title:$movie})<-[:RATED]-(u:User)-[:RATED]->(rec:Movie)
RETURN distinct rec.title AS recommendation LIMIT 20

Setup

This is for Neo4j version: 4.0

The database is also available on https://demo.neo4jlabs.com:7473

Username "recommendations", password: "recommendations", database: "recommendations"

Load graph data via the following:

Dump file: data/recommendations-embeddings-50.dump

The file was dumped from Neo4j 5.13. It is based on recommendations-50.dump, enriched with embeddings provided from https://data.neo4j.com/rec-embed/README.html on Movie nodes, under the property embedding. Embeddings are 1536-vectors generated with OpenAI’s model text-embedding-ada-002. The dump does not contain a vector index.

Dump file: data/recommendations-40.dump

  • Drop the file into the Files section of a project in Neo4j Desktop. Then choose the option to Create new DBMS from dump option from the file options.

  • Use the neo4j-admin tool to load data from the command line with the command below.

bin/neo4j-admin load --from data/recommendations-40.dump [--database "database"]

Code Examples

GraphQL API

See /graphql directory for Node.js GraphQL API server example using @neo4j/graphql

Feedback

Feel free to submit issues or pull requests for improvement on this repository.