Need help with rnn_recsys?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

140 Stars 37 Forks 16 Commits 5 Opened issues


Our implementation of the paper "Embedding-based News Recommendation for Millions of Users"

Services available


Need anything else?

Contributors list

# 19,346
14 commits


Our implementation of one research paper "Embedding-based News Recommendation for Millions of Users" Shumpei Okura, Yukihiro Tagami, Shingo Ono, and Akira Tajima. 2017. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD '17).

I provide a toy demo dataset to demonstrate the file format. On this dataset, model AVG has an AUC of 0.76, and model RNN has an AUC of 0.92. You can reproduce this simply by running 'python' . Sorry that I cannot upload my own real-world dataset (Bing News).

Overall, this recommender system has two steps: (1) train an autoencoder for articles ; (2) train RNN base on user-item interactions.

training autoencoder

The raw article has a format of "article_id \t category \t title". I will first build a word dictionary to hash the word to ids and count the TF-IDF statistics. The input for training autoencoder is the TF-IDF values of each article (title). Below is a result of my trained CDAE. (scripts can be found in helper/ alt text Analysis: I am really surprised by the great power of autoencoder. News titles are usually very short, but autoencoder can recover their intent. For example, for the first news, the input content is 'Travel tips for thanksgiving', our decoded words are (ordered by importance) 'tips, travel, holidays, thanksgiving, enjoy, shopping, period'. Note that the words 'holidays' and 'shopping' do not appear in the original title, but there are captured as strongly related words.

training curve of error:

alt text

training curve of loss:

alt text

training RNN recsys

After training the autoencoder, you need to encode each raw article to get their embeddings:


Finally, train your RNN recsys:


data description:

data/articles.txt: each line is an article, in the form of wordid:wordtfidfvalue

data/articlesCDAE.txt: each line is 3 articles, splited by tab, article01 and article02 belong to a same category, while article03 belongs to a different category

data/RS/articlesembeddings.txt: each line is an article, in the form of articleID \t embedding_vector (D float numbers, where D denotes the dimension of embedding)

data/RS/train.txt: each line is a training instance, in the form of userhistory \t targetitemid \t label. userhistory is a sequence of item_id, splited by space.

articlesTFIDFnorm3w.txt format: each line is one document, such as 14 17513:1.00 27510:0.81 , representing articleid \TAB wordid01:value \ SPACE wordid02:value \SPACE ....

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.