# Recurrent-Knowledge-Graph-Embedding
This is the code of a knowledge graph embedding framework – RKGE – with a novel recurrent network architecture for high-quality recommendation. RKGE [1] not only learns the semantic representation of different types of entities but also automatically captures entity relations encoded in KGs.
## Pre-requisits
- ### Running environment
- Python 3
- Pytorch (conda 4.5.11 - https://zhuanlan.zhihu.com/p/26854386)
- ### Datasets - MovieLens and Yelp.
- 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 save 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
```
- For the Yelp dataset, we use the originally provided genre and city information of the locations. The format is as follows:
```
id:11163|genre:Accountants,Professional Services,Tax Services,Financial Services|city:Peoria
```
## Modules of RKGE
- For clarify, hereafter we use movielen dataset as a toy example to demonstrate the detailed modules of RKGE. For yelp dataset, you need to do some adaptation for the code and tune some parameters (e.g., input_dim=20, hidden_dim=32, learning_rate=0.01).
- ### Auxiliary Info Mapping (auxiliary-mapping.py)
- Map the auxiliary infomation into ID
- Input Data: auxiliary.txt
- Output Data: auxilary-mapping.txt
- ### Data Split (data-split.py)
- Split the user-movie rating data into training and test data
- Input Data: rating-delete-missing-itemid.txt
- Output Data: training.txt, test.txt
- ### Negative Sample (negative-sample.py)
- Sample negative movies for each user to balance the model training
- Input Data: training.txt
- Output Data: negative.txt
- ### Path Extraction (path-extraction.py)
- Extract paths for both positive and negative user-moive interaction
- Input Data: training.txt, negative.txt, auxiliary-mapping.txt,
- Output Data: positive-path.txt, negative-path.txt
- ### Recurrent Neural Network (recurrent-neural-network.py)
- Feed both postive and negative path into the recurrent neural network, train and evaluate the model
- Input Data: positive-path.txt, negative-path.txt, training.txt, test.txt, pre-train-user-embedding.txt, pre-train-movie-embedding.txt (To speed up model training process, the user and movie embedding is pre-trained via [2]. You may also use matrix factorization [3] or bayesain personalized ranking [4] to pre-train the embeddings).
- Output Data: results.txt
- ### References
[1] Sun Zhu, Jie Yang et al. [Recurrent knowledge graph embedding for effective recommendation](http://sunzhuntu.wixsite.com/summer). ACM RecSys, 2018.
[2] Grbovic Mihajlo, et al. [E-commerce in your inbox: product recommendations at scale](https://arxiv.org/pdf/1606.07154.pdf). KDD, 2015
[3] Koren, Yehuda, Robert Bell, et al. [Matrix factorization techniques for recommender systems](https://datajobs.com/data-science-repo/Recommender-Systems-[Netflix].pdf). Computer, 2009
[4] Rendle, Steffen, et al. [BPR: bayesian personalized ranking from implicit feedback](https://arxiv.org/pdf/1205.2618.pdf). UAI, 2009.
没有合适的资源?快使用搜索试试~ 我知道了~
这是针对知识图谱嵌入推荐框架——RKGE_Python_下载.zip
共32个文件
txt:19个
py:10个
png:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 159 浏览量
2023-04-23
09:50:34
上传
评论
收藏 14.87MB ZIP 举报
温馨提示
这是针对知识图谱嵌入推荐框架——RKGE_Python_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
这是针对知识图谱嵌入推荐框架——RKGE_Python_下载.zip (32个子文件)
Recurrent-Knowledge-Graph-Embedding-master
LSTMTagger.py 2KB
auxiliary-mapping-yelp.py 2KB
path-extraction-ml.py 8KB
data
ml
training.txt 1.36MB
negative-path.txt 348KB
rating-delete-missing-itemid.txt 1.89MB
pre-train-user-embedding.txt 141KB
negative.txt 36KB
auxiliary-mapping.txt 52KB
positive-path.txt 6.37MB
test.txt 349KB
auxiliary.txt 192KB
pre-train-item-embedding.txt 253KB
movielens-results.png 27KB
yelp
training.txt 1.6MB
negative-path.txt 760KB
yelp-result.png 28KB
pre-train-user-embedding.txt 14.15MB
negative.txt 389KB
auxiliary-mapping.txt 178KB
positive-path.txt 10.6MB
test.txt 533KB
auxiliary.txt 677KB
pre-train-item-embedding.txt 4.3MB
path-extraction-yelp.py 7KB
LSTMTrain.py 3KB
LSTMEvaluation.py 2KB
negative-sample.py 3KB
recurrent-neural-network.py 8KB
auxiliary-mapping-ml.py 3KB
data-split.py 3KB
README.md 4KB
共 32 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功