Skip to content

kushmadlani/implicit-gcmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Implicit Graph Convolutional Matrix Completion (PyTorch)

Graph-based recommender system that extends Graph Convolutional Matrix Completion to the implicit feedback setting.

Note

Code base for GC-MC based from this implementation in Pytorch and Pytorch Geometric. The official implementation of original GC-MC method is this (Tensorflow).

Background

Blog post detailing the theory behind iGC-MC here.

Graph Convoluation Matrix Completion (GC-MC) views the problem of matrix completion on our observation matrix from the point of view of link prediction on graphs. In GC-MC, the interaction data is represented using bipartite user-item graph with labeled edges denoting observed ratings or interactions. Building on recent progress in deep learning on graph-structured data, the method proposes a graph auto-encoder framework based on differentiable message passing on the bipartite interaction graph.

We make the following changes and contributions to adapt the original GC-MC method to the implicit feedback setting. These are as follows:

  • Using a single edge type and processing channel to model whether that edge represents an interaction between the two nodes it connects (one user, one item). Previously each rating level was given its own processing channel.
  • Weigh messages according to their confidence, as given by the weighted average of edges weights incoming to that node.
  • Loss function. We change the model output from a score per rating level to a single scalar output, passed through a sigmoid nonlinearity so as to interpret it as the probability of interaction. Accordingly, our loss function became a binary cross-entropy loss vs what was previously a cross-entropy loss, where a softmax had been applied in the original presentation of the method.
  • Negative interactions. We sample a number of negative unobserved user-item pairs to contribute to the loss function. Learning would not be possible without this step, since the label of all items contributing to the loss would be positive. These unobserved user-item pairs correspond to `empty' edges on the graph.

Setup

  • Setup a virtual environment with python 3.6 or newer
  • Install requirements (pip)
    pip install -r requirements/1.txt
    pip install --verbose --no-cache-dir -r requirements/2.txt
    pip install -r requirements/3.txt
    

Please see Pytorch Geometric official document for installation details which can be troublesome.

Train and Test

cd src
python train.py -d lastfm -project 'igcmc_lastfm'
  • Configuration:
    The settings for train and test are configured using argparse, details in src\args.py

  • Dataset:
    Training dataset is Last.fm Dataset - 1K users. The dataset is automatically downloaded in data/ by running src/train.py.

Author

Kush Madlani

About

Graph Convolutional Matrix Completion for Implicit Feedback

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages