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
A movie recommender which recommends the movies belonging to the genre that user has liked the most.

Content-Based-Movie-Recommender-System This model relies on the similarity of the items being recommended. (I have used Pandas and Numpy. However othe

Srinivasan K 0 Mar 31, 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
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
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
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
Incorporating User Micro-behaviors and Item Knowledge 59 60 3 into Multi-task Learning for Session-based Recommendation

MKM-SR Incorporating User Micro-behaviors and Item Knowledge into Multi-task Learning for Session-based Recommendation Paper data and code This is the

ciecus 38 Dec 05, 2022
This library intends to be a reference for recommendation engines in Python

Crab - A Python Library for Recommendation Engines

Marcel Caraciolo 85 Oct 04, 2021
Codes for AAAI'21 paper 'Self-Supervised Hypergraph Convolutional Networks for Session-based Recommendation'

DHCN Codes for AAAI 2021 paper 'Self-Supervised Hypergraph Convolutional Networks for Session-based Recommendation'. Please note that the default link

Xin Xia 124 Dec 14, 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
Bundle Graph Convolutional Network

Bundle Graph Convolutional Network This is our Pytorch implementation for the paper: Jianxin Chang, Chen Gao, Xiangnan He, Depeng Jin and Yong Li. Bun

55 Dec 25, 2022
A recommendation system for suggesting new books given similar books.

Book Recommendation System A recommendation system for suggesting new books given similar books. Datasets Dataset Kaggle Dataset Notebooks goodreads-E

Sam Partee 2 Jan 06, 2022
Movie Recommender System

Movie-Recommender-System Movie-Recommender-System is a web application using which a user can select his/her watched movie from list and system will r

1 Jul 14, 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
Graph Neural Network based Social Recommendation Model. SIGIR2019.

Basic Information: This code is released for the papers: Le Wu, Peijie Sun, Yanjie Fu, Richang Hong, Xiting Wang and Meng Wang. A Neural Influence Dif

PeijieSun 144 Dec 29, 2022
Books Recommendation With Python

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

Çağrı Karadeniz 7 Mar 12, 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
Cross-Domain Recommendation via Preference Propagation GraphNet.

PPGN Codes for CIKM 2019 paper Cross-Domain Recommendation via Preference Propagation GraphNet. Citation Please cite our paper if you find this code u

Information Retrieval Group, Wuhan University, China 20 Dec 15, 2022
Recommendation Systems for IBM Watson Studio platform

Recommendation-Systems-for-IBM-Watson-Studio-platform Project Overview In this project, I analyze the interactions that users have with articles on th

Milad Sadat-Mohammadi 1 Jan 21, 2022
Deep recommender models using PyTorch.

Spotlight uses PyTorch to build both deep and shallow recommender models. By providing both a slew of building blocks for loss functions (various poin

Maciej Kula 2.8k Dec 29, 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