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:
- Word2Vec
- RDF2Vec
- Pyke
- ConEx
- HybridE (Combination of Word2Vec and ConEx)
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"
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.
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)
The class Cheater generates centroid vectors for each product found in the test set and evaluates them.
RDF2VEC: semantic-web-journal.net/system/files/swj1738.pdf Pyke: arxiv.org/pdf/2001.07418.pdf Conex: arxiv.org/pdf/2008.03130.pdf
Java 1.8
Maven 3.6.1