Skip to content

Develop a personalized recommendation system using a Knowledge Graph to model relationships between users, products, and interactions. Utilizing Python, Neo4j, Cypher, and Py2neo, this project aims to enhance user satisfaction through efficient data management and advanced recommendation algorithms.

License

Notifications You must be signed in to change notification settings

kaankvrck/KG-Enhanced-Recommender

Repository files navigation

Knowledge Graph Based Recommendation System

Project Overview

This project aims to develop a personalized recommendation system using a Knowledge Graph to model relationships between various entities such as users, products, and interactions. The recommendation system leverages graph-based algorithms and machine learning techniques to provide tailored suggestions to users based on their interactions and preferences.

Table of Contents

Dataset

The dataset consists of three CSV files containing information about products, customers, and sales interactions. The columns for each file are as follows:

Products

  • Uniqe Id
  • Product Name
  • Brand Name
  • Asin
  • Category
  • Upc Ean Code
  • List Price
  • Selling Price
  • Quantity
  • Model Number
  • About Product
  • Product Specification
  • Technical Details
  • Shipping Weight
  • Product Dimensions
  • Image
  • Variants
  • Sku
  • Product Url
  • Stock
  • Product Details
  • Dimensions
  • Color
  • Ingredients
  • Direction To Use
  • Is Amazon Seller
  • Size Quantity Variant
  • Product Description

Customers

  • Customer ID
  • Age
  • Gender
  • Item Purchased
  • Category
  • Purchase Amount (USD)
  • Location
  • Size
  • Color
  • Season
  • Review Rating
  • Subscription Status
  • Shipping Type
  • Discount Applied
  • Promo Code Used
  • Previous Purchases
  • Payment Method
  • Frequency

Sales

  • user id
  • product id
  • Interaction type
  • Time stamp

Technologies and Tools

  • Programming Language: Python
  • Graph Database: Neo4j
  • Query Language: Cypher
  • Libraries: Py2neo, Pandas, Scikit-learn, Pyspark, Faker

Installation and Setup

  1. Clone the repository:
    git clone https://github.com/yourusername/knowledge-graph-recommender.git
    cd knowledge-graph-recommender
  2. Clone the repository:
    pip install -r requirements.txt
  3. Set up Neo4j:
    • Install Neo4j from Neo4j Download Center.
    • Start Neo4j and set up your database.
    • Update the connection details in your code if necessary.

Usage

  1. Prepare the data:

    • Run the data_preparation.ipynb notebook to load and preprocess the dataset.
  2. Train the model:

    • Execute the model_training.ipynb notebook to train the recommendation model using the ALS algorithm.
  3. Generate recommendations:

    • Use the recommendations.ipynb notebook to get personalized recommendations for users.

Model Training and Evaluation

The project employs the Alternating Least Squares (ALS) algorithm for training the recommendation model. The evaluation metrics used to assess the model's performance include Root Mean Square Error (RMSE), Precision, Recall, and F1 Score.

Model Training

The training process involves the following steps:

  • Load and preprocess the data.
  • Encode user and product IDs.
  • Split the data into training and test sets.
  • Train the ALS model using the training set.

Model Evaluation

The model's performance is evaluated using the test set. The metrics calculated are:

  • RMSE: Measures the difference between predicted and actual interactions.
  • Precision: Measures the accuracy of the positive predictions.
  • Recall: Measures the ability of the model to identify all relevant items.
  • F1 Score: The harmonic mean of precision and recall.

Results

The results of the recommendation model are presented in terms of the evaluation metrics. The recommendations generated by the model can be visualized using Neo4j Browser.

Contributing

Contributions to this project are welcome. Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

Develop a personalized recommendation system using a Knowledge Graph to model relationships between users, products, and interactions. Utilizing Python, Neo4j, Cypher, and Py2neo, this project aims to enhance user satisfaction through efficient data management and advanced recommendation algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published