Accuracy-Diversity Trade-off in Recommender Systems via Graph Convolutions

Overview

Accuracy-Diversity Trade-off in Recommender Systems via Graph Convolutions

This repository contains the code of the paper "Accuracy-Diversity Trade-off in Recommender Systems via Graph Convolutions". For any question or suggestion, please e-mail Matteo Pocchiari at [email protected] or Elvin Isufi at [email protected].

Parts of this code are taken verbatim from the source code of the paper "Rating Prediction via Graph Signal Processing" (Huang et al., 2018) available here, while the graph neural networks part is inspired to the GNN library implemented by Fernando Gama, available here.

When using part of this code, please cite the following paper

Elvin Isufi, Matteo Pocchiari, Alan Hanjalic, "Accuracy-Diversity Trade-off in Recommender Systems via Graph Convolutions", in Information Processing and Management (2021).

  1. Introduction
  2. Accounting For Disimilar Furthest Neighbors
  3. Code

1. Introduction

We work with a set of users , with and a set of items , with . Each user can give a rating to the items in . We write the available ratings in matrix form, by filling the user-item matrix (UIM) , where entry contains the rating user u gave to item i. The goal is to predict the missing ratings of the UIM, to obtain the matrix with all the predictions.

Consider a graph defined by a set of nodes and a set of edges . On top of the graph we define a graph signal which associates a scalar to each node in . We use graph signal processing tools to predict the missing entries of the UIM and obtain . We define the user-similarity graph , which can be particularized according to the specific item i with the adjacency matrix and the graph signal . Likewise, the item-similarity graph is described by the user specific adjacency matrix and the graph signal .

We use graph convolutional filters both in linear and nonlinear (see figure below) fashion to predict the missing ratings. In the user setting, we use the graph convolutional filter described by the set of coefficients to predict the ratings specific to item i: the vector contains the predictions all users in would give to item i. Similarly for the item case, we work with the graph convolutional filter to predict the ratings a specific user u would give to all the items in ; therefore all the predictions for the user u are contained in the vector . To generalize, we work with a map which can be a plain graph convolutional filter or a graph convolutional neural network.

2. Accounting For Disimilar Furthest Neighbors

We propose to use graph convolutions for establishing a novel accuracy-diversity trade-off for RS, by means of a novel accuracy-diversity trade-off framework for RS via graph convolutions. The model jointly operates on a NN graph to improve accuracy and on a FN graph to improve diversity. Each graph can capture user-user or item-item relationships, allowing to also include the hybrid settings, such as a user-NN and an item-FN graph. We develop design strategies that estimate the joint model parameters in view of both accuracy and diversity. These design strategies are versatile to both rating and ranking frameworks. In the rating case, they optimize the mean square error between the prediction and the true rating and consider the accuracy-diversity trade-off as a regularizer. In the ranking case, they optimize the Bayesian personalized ranking criterion proposed by Rendle et al., to account for the final order in the recommendation list, and the accuracy-diversity trade-off is also considered the regularizer.

Leveraging Negative Correlations

We work with a NN similarity-graph and a FN dissimilarity-graph . The dissimilarity graph is built by following the opposite principles of NNs, i.e., connecting each entity to its top-n most negatively related ones. On each graph and we have a convolutional module and , outputting an estimate of the user-item matrix and , respectively. We combine the two outputs in the joint estimate , where scalar balances the influence of the similar and dissimilar connections.

Each graph or can be a user or an item graph and the graph convolutional modules can be linear or nonlinear. This framework yields eights combinations to investigate the trade-off. To ease exposition, we shall discuss the theoretical methods with the hybrid combination user NN graph (i.e., with adjacency matrix for item i) and item FN graph (i.e., with adjacency matrix for user u). This setting implies we predict rating by learning, on one side, from the coupling , and, on the other side, from the coupling .

Learning For Rating

We estimate the joint model parameters w.r.t. the mean squared error (MSE) criterion. Analyzing the MSE quantifies also the trade-off for all items in the dataset (unbiasing the results from the user preferences in the list). To this end, consider a training set of user-item pairs T={(u,i)} for the available ratings in X. Consider also the user-similarity graph , the item-dissimilarity graph (i.e., , and their respective graph convolutions and . We estimate parameters and by solving the regularized problem

where measures the fitting error w.r.t. the available ratings , while the second term acts as an accuracy-diversity regularizer. The two filters and can be either two plain graph convolutional filters, or two GCNNs, with implications about optimality and expressivity, which we discuss thoroughly in the paper.

Learning For Ranking

We considered the Bayesian personalized ranking (BPR), which is a state-of-the-art learn-to-ranking framework (Rendle et al.). BPR considers the rating difference a user u has given to two items i and j. The term is used in the loss function

where is the sigmoid function. More details about the BPR criterion and its derivation can be found in the paper. As in the case of rating optimization, the convolutions and used in the prediction can be either two plain graph convolutional filters or two GCNNs.

3. Code

The code is written in Python 3. Model with linear optimization rely on NumPy and SciPy, while models with nonlinear optimization make use of PyTorch. Linear rating optimization is taken from the source code of the paper "Rating Prediction via Graph Signal Processing" (Huang et al., 2018) available here. Linear ranking optimization is inspired to the BPR implmentation from the code of the paper "Bayesian Personalized Ranking with Multi-Channel User Feedback (Loni et al., 2016)", available here. Nonlinear rating and ranking optimization is inspired to the GNN implementation of Fernando Gama, available here.

Dependecies

To run the code, the following libraries are required: os, argparse, torch, sys, numpy, scipy, ast, time, datetime, math, itertools, pickle.

Usage

The code is divided into four main files: linearRating, linearRanking, nonlinearRating, nonlinearRanking, corresponding to the four possible aforementioned combinations. To run the code, download/clone the repository on your desktop, open the terminal in the folder and run from the terminal: python [selected_mode] [parameters].

The list of parameters is the following:

  • -method [string: UU (default), UI, IU, II]: defines the combination of users/items to use. The first letter defines the similarity source, while the second defines the dissimilarity source (U for users, I for Items).
  • -simOrd [int: default 1]: defines the order of the graph filter applied on the similarity graph.
  • -disOrd [int: default 1]: defines the order of the graph filter applied on the dissimilarity graph.
  • -simNeigh [int: default 30]: defines the number of neighbors in the similarity graph.
  • -disNeigh [int: default 40]: defines the number of neighbors in the dissilarity graph.
  • -mu [float: default 1.0]: defines the parameter responsible for the overfitting in the optimization function.
  • -alpha [float: default 0.1]: defines the value of alpha, i.e. how much importance should be given to the dissimilarity graph.
  • -dataset [string: ml100k (deafult), ml1m, douban, flixster]: defines the dataset to use.
  • -epochs [int: default 1]: defines the number of epochs, i.e. how many times the dataset is traversed in the training.
  • -lr [float: default 0.001]: defines the learning rate.
  • -batch [int: default 1]: defines the batch size.
  • -neg [int: default 4]: defines the number of "negative" samples to consider in the BPR, in case of ranking optimization.
  • -feat [list: default [1,2]]: defines the number of features of the GCNN.

The script linearRating.py accepts as parameters -method, -simOrd, -disOrd, -simNeigh, -disNeigh, -mu, -alpha, -dataset;

The script linearRanking.py accepts as parameters -method, -simOrd, -disOrd, -mu, -alpha, -dataset, -epochs, -batch, -neg, -lr;

The script nonlinearRating.py accepts as parameters -method, -simOrd, -disOrd, -mu, -alpha, -dataset, -epochs, -batch, -lr, -feat;

The script nonlinearRanking.py accepts as parameters -method, -simOrd, -disOrd, -mu, -alpha, -dataset, -epochs, -batch, -lr, -feat, -neg;

Examples

  • Linear rating optimization: python linearRating.py -method UI -simOrd 3 -disOrd 2 -simNeigh 30 -disNeigh 40 -mu 0.5 -alpha 0.1 -dataset ml100k
  • Linear ranking optimization: python linearRanking.py -method UI -simOrd 1 -disOrd 2 mu 0.5 -alpha 0.1 -dataset ml100k -epochs 1 -batch 1 -neg 4 -lr 0.00001
  • Nonlinear rating optimization: python nonlinearRating.py -method UI -simOrd 1 -disOrd 2 mu 0.5 -alpha 0.1 -dataset ml100k -epochs 1 -batch 1 -lr 0.00001 -feat [1,4]
  • Nonlinear ranking optimization: python nonlinearRating.py -method UI -simOrd 1 -disOrd 2 mu 0.5 -alpha 0.1 -dataset ml100k -epochs 1 -batch 1 -lr 0.00001 -feat [1,4] -neg 4
Handling Information Loss of Graph Neural Networks for Session-based Recommendation

LESSR A PyTorch implementation of LESSR (Lossless Edge-order preserving aggregation and Shortcut graph attention for Session-based Recommendation) fro

Tianwen CHEN 62 Dec 03, 2022
Movies/TV Recommender

recommender Movies/TV Recommender. Recommends Movies, TV Shows, Actors, Directors, Writers. Setup Create file API_KEY and paste your TMDB API key in i

Aviem Zur 3 Apr 22, 2022
Collaborative variational bandwidth auto-encoder (VBAE) for recommender systems.

Collaborative Variational Bandwidth Auto-encoder The codes are associated with the following paper: Collaborative Variational Bandwidth Auto-encoder f

Yaochen Zhu 14 Dec 11, 2022
Persine is an automated tool to study and reverse-engineer algorithmic recommendation systems.

Persine, the Persona Engine Persine is an automated tool to study and reverse-engineer algorithmic recommendation systems. It has a simple interface a

Jonathan Soma 87 Nov 29, 2022
Cloud-based recommendation system

This project is based on cloud services to create data lake, ETL process, train and deploy learning model to implement a recommendation system.

Yi Ding 1 Feb 02, 2022
Bert4rec for news Recommendation

News-Recommendation-system-using-Bert4Rec-model Bert4rec for news Recommendation

saran pandian 2 Feb 04, 2022
基于个性化推荐的音乐播放系统

MusicPlayer 基于个性化推荐的音乐播放系统 Hi, 这是我在大四的时候做的毕设,现如今将该项目开源。 本项目是基于Python的tkinter和pygame所著。 该项目总体来说,代码比较烂(因为当时水平很菜)。 运行的话安装几个基本库就能跑,只不过里面的数据还没有上传至Github。 先

Cedric Niu 6 Nov 19, 2022
Books Recommendation With Python

Books-Recommendation Business Problem During the last few decades, with the rise

Çağrı Karadeniz 7 Mar 12, 2022
Jointly Learning Explainable Rules for Recommendation with Knowledge Graph

Jointly Learning Explainable Rules for Recommendation with Knowledge Graph

57 Nov 03, 2022
Recommender systems are the systems that are designed to recommend things to the user based on many different factors

Recommender systems are the systems that are designed to recommend things to the user based on many different factors. The recommender system deals with a large volume of information present by filte

Happy N. Monday 3 Feb 15, 2022
Plex-recommender - Get movie recommendations based on your current PleX library

plex-recommender Description: Get movie/tv recommendations based on your current

5 Jul 19, 2022
RecSim NG: Toward Principled Uncertainty Modeling for Recommender Ecosystems

RecSim NG, a probabilistic platform for multi-agent recommender systems simulation. RecSimNG is a scalable, modular, differentiable simulator implemented in Edward2 and TensorFlow. It offers: a power

Google Research 110 Dec 16, 2022
[ICDMW 2020] Code and dataset for "DGTN: Dual-channel Graph Transition Network for Session-based Recommendation"

DGTN: Dual-channel Graph Transition Network for Session-based Recommendation This repository contains PyTorch Implementation of ICDMW 2020 (NeuRec @ I

Yujia 25 Nov 17, 2022
A library of Recommender Systems

A library of Recommender Systems This repository provides a summary of our research on Recommender Systems. It includes our code base on different rec

MilaGraph 980 Jan 05, 2023
A framework for large scale recommendation algorithms.

A framework for large scale recommendation algorithms.

Alibaba Group - PAI 880 Jan 03, 2023
EXEMPLO DE SISTEMA ESPECIALISTA PARA RECOMENDAR SERIADOS EM PYTHON

exemplo-de-sistema-especialista EXEMPLO DE SISTEMA ESPECIALISTA PARA RECOMENDAR SERIADOS EM PYTHON Resumo O objetivo de auxiliar o usuário na escolha

Josue Lopes 3 Aug 31, 2021
The implementation of the submitted paper "Deep Multi-Behaviors Graph Network for Voucher Redemption Rate Prediction" in SIGKDD 2021 Applied Data Science Track.

DMBGN: Deep Multi-Behaviors Graph Networks for Voucher Redemption Rate Prediction The implementation of the accepted paper "Deep Multi-Behaviors Graph

10 Jul 12, 2022
Learning Fair Representations for Recommendation: A Graph-based Perspective, WWW2021

FairGo WWW2021 Learning Fair Representations for Recommendation: A Graph-based Perspective As a key application of artificial intelligence, recommende

lei 39 Oct 26, 2022
A TensorFlow recommendation algorithm and framework in Python.

TensorRec A TensorFlow recommendation algorithm and framework in Python. NOTE: TensorRec is not under active development TensorRec will not be receivi

James Kirk 1.2k Jan 04, 2023
QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented.

Yu 1.4k Dec 27, 2022