Jointly Learning Explainable Rules for Recommendation with Knowledge Graph

Overview

RuleRec

These are our datasets and implementation for the paper:

Weizhi Ma, Min Zhang, Yue Cao, Woojeong Jin, Chenyang Wang, Yiqun Liu, Shaoping Ma, and Xiang Ren. 2019. Jointly Learning Explainable Rules for Recommendation with Knowledge Graph. In TheWebConf'19.

Please cite our paper if you use our datasets or codes. Thanks!

@inproceedings{ma2019jointly,
  title={Jointly Learning Explainable Rules for Recommendation with Knowledge Graph},
  author={Ma, Weizhi and Zhang, Min and Cao, Yue and Jin, Woojeong and Wang, Chenyang and Liu, Yiqun and Ma, Shaoping and Ren, Xiang},
  booktitle={The World Wide Web Conference},
  pages={1210--1221},
  year={2019},
  organization={ACM}
}

If you have any problem about this work, you can contact Weizhi Ma (mawz12 AT hotmail.com).

RuleRec Datasets

The constructed datasets (two scenarios: Amazon cellphone and Amazon electronic) can be found here, which contain several parts:

Recommendation Data:

train.txt, test.txt: user-item interaction data.

Formatting: 
	user id \t item id

item_dic.txt: A python dic, key = item id in Amazon, value = item id here.

Item Attributes:

title.txt, brand.txt, description.txt: item attributes.

Formatting: 
	item id in Amazon \t the title/brand/description of this item

Item Associations:

also_buy.txt, also_view.txt, buy_after_view.txt, buy_together.txt: item associations.

Formatting:
	item id in Amazon \t items that have also\_buy/also\_view/buy\_after\_view/buy\_together association with this item, split by ' '

Entity Linking Data:

title_entities.txt, brand_entities.txt, description_entities.txt: entity linking results on freebase.

Formatting:
	item id in Amazon \t entity name \t entity id in Freebase

Path data:

KGData/*/rule_score.txt: As Freebase is an extremely large knowledge graph, only the related paths in the knowledge graph are recorded in this file. The head and tail entity of each path linked by at least one item.

training_pairs.txt and usercandidates.txt are two files sampled for rule learning and recommendation. You can replace them with other sampling results. The formatting of training_pairs.txt is 'user id : [positive item id, negative item id]'.



Besides, the original Amazon datasets (including user-item interaction history and item associations) are provided by Professor Mcauley. You can download them here.

Rule Learning Codes

If you want to use these codes, you should download RuleRec dataset and put them together first.

getItemItemDic.py: Enumerate all possible rules.

selectRules.py: Rule selection (rule features for jointly learning will also be generated in this step).

getFeatures.py: Calculate features based on the selected rules for item recommendation.

Environments: Python 3.6.3

sklearn = 0.19.1

numpy = 1.13.3

# Example:
> python getItemItemDic.py Cellphone abu
> python selectRules.py Cellphone abu 50
> python getFeatures.py Cellphone abu 50

RuleRec(BPRMF) Codes:

This implementation is based on MyMediaLiteJava. Both codes and jar file are provided.

The evaluation datasets can be downloaded from here, which is generated from RuleRec Data and contains both rule selection features and rule features.

Environments: Java, version 1.6 or later

# Example 1: Use Cellphone dataset
> java -jar BPRMF.jar --recommender=BPRMF --training-file=./RuleRecInput/Cellphone/trainingSet.txt --test-file=./RuleRecInput/Cellphone/testSet.txt --candidateFile=./RuleRecInput/Cellphone/candidates.txt --trainingPairFile=./RuleRecInput/Cellphone/trainingPairs.txt --trainingFeatures=./RuleRecInput/Cellphone/trainingFeatures.txt --testFeatures=./RuleRecInput/Cellphone/testFeatures.txt --learningRate=0.1 --usermodel=0 --iter-times=30 --rule-weight=0.005  --ruleWeightNumber=200 --resultFile=result.txt 
# output:[email protected]=0.34968 [email protected]=0.48024 [email protected]=0.28287 [email protected] num_users=27840 num_items=100 num_lists=27840

# Example 2: Use Cellphone dataset with jointly learning
> java -jar BPRMF.jar --recommender=BPRMF --training-file=./RuleRecInput/Cellphone/trainingSet.txt --test-./RuleRecInput/Cellphone/testSet.txt --candidateFile=./RuleRecInput/Cellphone/candidates.txt --trainingPairFile=./RuleRecInput/Cellphone/trainingPairs.txt --trainingFeatures=./RuleRecInput/Cellphone/trainingFeatures.txt --testFeatures=./RuleRecInput/Cellphone/testFeatures.txt --learningRate=0.1 --usermodel=0 --iter-times=30 --rule-weight=0.005  --ruleWeightNumber=200 --resultFile=result.txt --trainTogether=2  --lossType=sigmoid --lossCombineRate=0.2 --ruleselectTrain=./RuleRecInput/Cellphone/ruleselect/ --ruleselectResult=./RuleRecInput/Cellphone/ruleselect/ 
# output:[email protected]=0.36430 [email protected]=0.49429 [email protected]=0.29536 [email protected]=0.23214 num_users=27840 num_items=100 num_lists=27840

# Example 3: Use Electronic dataset
> java -jar BPRMF.jar --recommender=BPRMF --training-file=./RuleRecInput/Electronic/trainingSet.txt --test-file=./RuleRecInput/Electronic/testSet.txt --candidateFile=./RuleRecInput/Electronic/candidates.txt --trainingPairFile=./RuleRecInput/Electronic/trainingPairs.txt --trainingFeatures=./RuleRecInput/Electronic/trainingFeatures.txt --testFeatures=./RuleRecInput/Electronic/testFeatures.txt --learningRate=0.05 --ruleWeightNumber=200 --usermodel=0 --iter-times=30 --rule-weight=0.01 --resultFile=result.txt 
# output:[email protected]=0.20694 [email protected]=0.29726 [email protected]=0.17284 [email protected]=0.13483 num_users=18223 num_items=100 num_lists=18223

# Example 4: Use Electronic dataset with jointly learning
> java -jar BPRMF.jar --recommender=BPRMF --training-file=./RuleRecInput/Electronic/trainingSet.txt --test-file=./RuleRecInput/Electronic/testSet.txt --candidateFile=./RuleRecInput/Electronic/candidates.txt --trainingPairFile=./RuleRecInput/Electronic/trainingPairs.txt --trainingFeatures=./RuleRecInput/Electronic/trainingFeatures.txt --testFeatures=./RuleRecInput/Electronic/testFeatures.txt --learningRate=0.05 --ruleWeightNumber=200 --usermodel=0 --iter-times=30 --rule-weight=0.01 --resultFile=result.txt --trainTogether=2  --lossType=sigmoid --lossCombineRate=0.005 --ruleselectTrain=./RuleRecInput/Electronic/ruleselect/ --ruleselectResult=./RuleRecInput/Electronic/ruleselect/ 
# output:[email protected]=0.20798 [email protected]=0.29979 [email protected]=0.17407 [email protected]=0.13570 num_users=18223 num_items=100 num_lists=18223
Beyond Clicks: Modeling Multi-Relational Item Graph for Session-Based Target Behavior Prediction

MGNN-SPred This is our Tensorflow implementation for the paper: WenWang,Wei Zhang, Shukai Liu, Qi Liu, Bo Zhang, Leyu Lin, and Hongyuan Zha. 2020. Bey

Wen Wang 18 Jan 02, 2023
Use Jupyter Notebooks to demonstrate how to build a Recommender with Apache Spark & Elasticsearch

Recommendation engines are one of the most well known, widely used and highest value use cases for applying machine learning. Despite this, while there are many resources available for the basics of

International Business Machines 793 Dec 18, 2022
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
It is a movie recommender web application which is developed using the Python.

Movie Recommendation 🍿 System Watch Tutorial for this project Source IMDB Movie 5000 Dataset Inspired from this original repository. Features Simple

Kushal Bhavsar 10 Dec 26, 2022
Recommender System Papers

Included Conferences: SIGIR 2020, SIGKDD 2020, RecSys 2020, CIKM 2020, AAAI 2021, WSDM 2021, WWW 2021

RUCAIBox 704 Jan 06, 2023
Real time recommendation playground

concierge A continuous learning collaborative filter1 deployed with a light web server2. Distributed updates are live (real time pubsub + delta traini

Mark Essel 16 Nov 07, 2022
reXmeX is recommender system evaluation metric library.

A general purpose recommender metrics library for fair evaluation.

AstraZeneca 258 Dec 22, 2022
ToR[e]cSys is a PyTorch Framework to implement recommendation system algorithms

ToR[e]cSys is a PyTorch Framework to implement recommendation system algorithms, including but not limited to click-through-rate (CTR) prediction, learning-to-ranking (LTR), and Matrix/Tensor Embeddi

LI, Wai Yin 90 Oct 08, 2022
Graph Neural Networks for Recommender Systems

This repository contains code to train and test GNN models for recommendation, mainly using the Deep Graph Library (DGL).

217 Jan 04, 2023
Implementation of a hadoop based movie recommendation system

Implementation-of-a-hadoop-based-movie-recommendation-system 通过编写代码,设计一个基于Hadoop的电影推荐系统,通过此推荐系统的编写,掌握在Hadoop平台上的文件操作,数据处理的技能。windows 10 hadoop 2.8.3 p

汝聪(Ricardo) 5 Oct 02, 2022
A PyTorch implementation of "Say No to the Discrimination: Learning Fair Graph Neural Networks with Limited Sensitive Attribute Information" (WSDM 2021)

FairGNN A PyTorch implementation of "Say No to the Discrimination: Learning Fair Graph Neural Networks with Limited Sensitive Attribute Information" (

31 Jan 04, 2023
Temporal Meta-path Guided Explainable Recommendation (WSDM2021)

Temporal Meta-path Guided Explainable Recommendation (WSDM2021) TMER Code of paper "Temporal Meta-path Guided Explainable Recommendation". Requirement

Yicong Li 13 Nov 30, 2022
This is our implementation of GHCF: Graph Heterogeneous Collaborative Filtering (AAAI 2021)

GHCF This is our implementation of the paper: Chong Chen, Weizhi Ma, Min Zhang, Zhaowei Wang, Xiuqiang He, Chenyang Wang, Yiqun Liu and Shaoping Ma. 2

Chong Chen 53 Dec 05, 2022
A Python scikit for building and analyzing recommender systems

Overview Surprise is a Python scikit for building and analyzing recommender systems that deal with explicit rating data. Surprise was designed with th

Nicolas Hug 5.7k Jan 01, 2023
Self-supervised Graph Learning for Recommendation

SGL This is our Tensorflow implementation for our SIGIR 2021 paper: Jiancan Wu, Xiang Wang, Fuli Feng, Xiangnan He, Liang Chen, Jianxun Lian,and Xing

151 Dec 20, 2022
Code for KHGT model, AAAI2021

KHGT Code for KHGT accepted by AAAI2021 Please unzip the data files in Datasets/ first. To run KHGT on Yelp data, use python labcode_yelp.py For Movi

32 Nov 29, 2022
Spark-movie-lens - An on-line movie recommender using Spark, Python Flask, and the MovieLens dataset

A scalable on-line movie recommender using Spark and Flask This Apache Spark tutorial will guide you step-by-step into how to use the MovieLens datase

Jose A Dianes 794 Dec 23, 2022
Dual Graph Attention Networks for Deep Latent Representation of Multifaceted Social Effects in Recommender Systems

DANSER-WWW-19 This repository holds the codes for Dual Graph Attention Networks for Deep Latent Representation of Multifaceted Social Effects in Recom

Qitian Wu 78 Dec 10, 2022
Code for my ORSUM, ACM RecSys 2020, HeroGRAPH: A Heterogeneous Graph Framework for Multi-Target Cross-Domain Recommendation

HeroGRAPH Code for my ORSUM @ RecSys 2020, HeroGRAPH: A Heterogeneous Graph Framework for Multi-Target Cross-Domain Recommendation Paper, workshop pro

Qiang Cui 9 Sep 14, 2022
Spotify API Recommnder System

This project will access your last listened songs on Spotify using its API, then it will request the user to select 5 favorite songs in that list, on which the API will proceed to make 50 recommendat

Kevin Luke 1 Dec 14, 2021