Skip to content

Scharfi/KG-RecommendationSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KG-based Recommendation System

Introduction

This repository contains the code of a recommendation system that uses an artificial neural network and a learning-to-rank approach to generate the recommendations. The recommendation system produces Top-N recommended products for a given product. The recommendation system can be trained and tested on various embedding models that were produced from a Knowledge Graph.

The embedding model in this repository are generated using different embedding algorithm:

  1. Word2Vec
  2. RDF2Vec
  3. Pyke
  4. ConEx
  5. HybridE (Combination of Word2Vec and ConEx)

Generate the train and test data

To train and test the model, the data has to be generated by the class dataprocessor where you can specify the name of the embedding model of choice (w2v, r2v, pyke, conex, hybride). To build centroid-based data, change centroid to "true" (not for HybridE).

mvn exec:java -Dexec.mainClass=dataprocessor -Dexec.args="conex false"
args1="Embedding model name" args2="true/false"

Train the recommender

The training of the recommender is done in Class trainer. The model can be saved at any training phase (epoch), where it can be specified in the arguments:

mvn exec:java -Dexec.mainClass=trainer -Dexec.args="conex 10 0.5 0.0000001 9000 no"
args1="Embedding model name" args2="Number of epochs" args3="LearningRate" args4="L2" args5="HiddenNodes" args6="Yes/No"(saveModel-optional)

The best performance configuration for each models:

EmbeddingModelNames #LearningRate #L2 #HiddenNodes
w2v 0.9 1e-7 9000
r2v 0.5 1e-7 9000
pyke 0.5 1e-7 9000
conex 0.5 1e-7 9000
hybride 0.9 1e-7 9000

The evaluation results are stored under data/evaluation/model_name.

load a saved model for further evaluation

After training, the recommender model can be saved under directory "models". Thus, the models can be again loaded and trained for more epochs and evaluated.

mvn exec:java -Dexec.mainClass=loader -Dexec.args="conex 10 conex1 yes"
args1="Embedding model name" args2="Number of epochs" args3="Model Name" args4="Yes/No"(saveModel-optional)

Other trainer

The class Cheater generates centroid vectors for each product found in the test set and evaluates them.

Research paper

RDF2VEC: semantic-web-journal.net/system/files/swj1738.pdf Pyke: arxiv.org/pdf/2001.07418.pdf Conex: arxiv.org/pdf/2008.03130.pdf

Requirement

Java 1.8

Maven 3.6.1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages