Skip to content

D2KLab/entity2rec

Repository files navigation

entity2rec

Implementation of the entity recommendation algorithm described in entity2rec: Learning User-Item Relatedness from Knowledge Graphs for Top-N Item Recommendation. Compute user and item embeddings from a Knowledge Graph encompassing both user feedback information and item information. It is based on property-specific entity embeddings, which are obtained via entity2vec (https://github.com/MultimediaSemantics/entity2vec). Slides can be found on Slideshare. The main difference between the current implementation and what is reported in the paper is the evaluation protocol, which now ranks all the items for each user, and the use of hybrid property-specific subgraphs to compute the property-specific knowledge graph embeddings.

The command: python entity2rec/main.py --dataset LibraryThing --run_all will run entity2rec on the LibraryThing dataset. The first time it will generate the embeddings files and save them into emb/LibraryThing/. Afterwards, it will check whether the embeddings files already exist in the folder. Then, it computes property-specific relatedness scores and evaluates recommendations using a set of possible aggregation functions (LambdaMart, average, max and min) on a set of relevant metrics.

The configuration of properties.json is used to select the properties. By default, it will use hybrid property-specific subgraphs (feedback + content property). To use collaborative-content subgraphs, the user should replace the content of config/properties.json with that of config/properties_collaborative_content_example.json.

Requirements

  • Python 2.7 or above

If you are using pip:

    pip install -r requirements.txt

Our Publications