Giter Club home page Giter Club logo

agnn's Introduction

AGNN

Introduction

Attentive Graph Neural Network (AGNN) is a new recommendation framework tailored to knowledge graph-based personalized recommendation. Built upon the graph neural network framework, AGNN explicitly models the semantics encoded in KGs with expressive subgraphs to provide better recommendation with side information.

Environment Requirement

  • Python 2.7
  • Pytorch (cudatoolkit=9.0)
  • numpy == 1.16.2
  • networkx == 2.2

Datasets

  • MovieLens

    • For the MoiveLens dataset, we crawl the corresponding IMDB dataset as movie auxiliary information, including genre, director, and actor. Note that we automatically remove the movies without auxilairy information. We then combined MovieLens and IMDB by movie title and released year. The combined data is saved in a txt file (auxiliary.txt) and the format is as follows:

      id:1|genre:Animation,Adventure,Comedy|director:John Lasseter|actors:Tom Hanks,Tim Allen,Don Rickles,Jim Varney
      
    • For the original user-movie rating data, we remove all items without auxiliary information. The data is save in a txt file (rating-delete-missing-itemid.txt) and the format is as follows:

      userid itemid rating timestamp
      
  • Last-FM

    • This is the music listening dataset collected from Last.fm online music systems. Wherein, the tracks are viewed as the items. In particular, we take the subset of the dataset where the timestamp is from Jan, 2015 to June, 2015. For Last-FM,we map items into Freebase entities via title matching if there is a mapping available. The overall KG is saved in kg_final.txt and the format is as follows:

      head_entity_id  relation_id  tail_entity_id
      
  • Yelp

    • It records user ratings on local business scaled from 1-5. Additionally, social relations as well as business attributes (e.g., category, city) are also included. For Yelp, we extract item knowledge from the local business information network (e.g., category, location, and attribute) as KG data. The format is as follows:

      id:11163|genre:Accountants,Professional Services,Tax Services,Financial Services|city:Peoria
      

Modules

For clarify, hereafter we use movieLens dataset as a toy example to demonstrate the detailed modules of AGNN.

  • Data Split (split_train_test.py)

    • Split the user-movie rating data into training and test data

    • Input Data: user_movies.txt

    • Output Data: training.txt, test.txt

  • Negative Sample (negative_sample_for_train.py, negative_sample_for_test.py)

    • Sample negative movies for each user to balance the model training & Sample negative movies for test.

    • Input Data: training.txt; test.txt

    • Output Data: negative.txt; test_negative.txt

  • Path Sampling (path_positive.py, path_negative.py, path_test_negative.py)

    • Extract paths for positive and negative user-moive interaction and prepare paths data for test, respectively.

    • Input Data: user-movie interaction for positive/negative/test rating

    • Output Data: sampled path for positive/negtiave/test user-item pair

  • Attentive Graph Neural Network (model.py)

    • Model for Attentive Graph Neural Network
  • Train and Test (GGNNTrain_Relation.py, Main.py)

    • Feed both postive and negative path into the AGNN, train and evaluate the model
  • References

    [1] Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. 2015. Learningentity and relation embeddings for knowledge graph completion. In AAAI.

    [2] Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Ok-sana Yakhnenko. 2013. Translating embeddings for modeling multi-relationaldata. In NIPS. 2787–2795.

    [3] Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. 2014. Knowledgegraph embedding by translating on hyperplanes. In AAAI.

agnn's People

Stargazers

 avatar Marlin avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.