DEIM Forum 2016 C8-1

Distributed Representation-based Recommender Systems in E-commerce
Van-Thuy Phi†

Liu Chen‡†Nara Institute of Science and Technology

and

Yu Hirate‡

8916-5 Takayama, Ikoma, Nara, 630-0192 Japan‡Rakuten Institute of Technology 1-14-1 Setagaya-ku, Tokyo, 158-0094 Japan
E-mail:†phi.thuy.ph8@is.naist.jp,‡{chen.liu, yu.hirate}@rakuten.com

Abstract
Recommender system plays an important role in many e-commerce services, such as in Rakuten. In this paper,
we focus on the item-to-item recommender and the user-to-item recommenders, which are two most widely used functions in
online services for presenting relevant items given an item, or a particular user. We use a large amount of log data from one of
Rakuten markets, and apply distributed representation method to that data for developing two types of recommender systems.
The key idea of our approach is treating items as words, and users’ sessions as sentences, then training the Word2vec modeland Doc2vec models based on those items and user’s information. Resulting item vectors from the Word2vec model can beused to calculate the cosine similarity between items, and find the similar items given an item. Similarly, Doc2vec model helps
users find relevant items that might interest them using similarity between items and vectors. We also use the item vectors fromboth embedding models to build an additional user-to-item recommender, namely Item Vector-based system. The experiments
show that our best system achieved a hit-rate of 24.17% for recommending items to users in testing data, which outperformed
conventional approaches to a significant extent.
Keyword Recommender System，Distributed Representation，Item Vector-basedshown

1. Introduction
Recommender system plays an important role in manytoefficiently

learn

meaningful

distributed

representations of words or phrases (aka word embedding)

e-commerce services, such as Rakuten . Its goal is to offerfrom un-annotated text. In the distributed representation,

relevant items given an item, or a particular user.

If thesimilar words are projected into similar vectors. Vectors

system suggests similar items given an item, it provides

from Word2vec model conserve some of the semantic

item-to-item recommendation. In user-to-item case, thischaracteristics

system helps users to find relevant items that might

information that they capture.

1

interest

them.

We

focus

on

these

two

kinds

of

in

operations

regardingthesemantic

Word2vec model is great for capturing meaning ofrecommender systems, because they are commonly used in

words

or

phrases.

However,it

only

learnsword

real-time services.

embeddings based on the words’ context. Le and Mikolov

Conventional approaches for building recommender(2014) presented a novel method for generating thesystems are divided into three classes: collaborative

distributed representations of sentences and documents

filtering methods, content-based methods, and hybrid(akamethods.

help

Doc2vec is an extension of Word2vec that learns tousers/customers to make choices based on the opinions of

capture not just individual words but entire sentence andother people who share similar interests [2, 7, 8, 9]. They

paragraph. Traditionally, Word2vec and Doc2vec models

are considered to be the most popular and widely

are trained on textual corpus data but here we utilize it on

implemented

systems.

the log data of users. We are therefore treating each item

Content-based systems recommend items to users by

as a “word” and the “sentences” are the ordered actions

comparing each item’s attributes with the user profile so(e.g., viewing history of users). Then the originalthat only items that have a high degree of similarity with

Word2Vec method can be applied in the recommendation

the user profile will be recommended [4, 6]. Hybrid

scenario.

Collaborative

recommenders

techniques

arefilteringinsystems(CF)

methods

recommendation

that

combinemultiple

recommendations techniques together.
Recently, Mikolov et al. (2013) have introduced theskip-gram text modeling architecture [5]. It has been

Doc2vecmodel,

orsentenceembeddings)[3].

Based on the distributed representation approach, weapply it to the users’ behavior data. The details of ourcontribution are as follows:•

We train the Word2vec model to assign a vector
for each item, and build the item-to-item

1

http://global.rakuten.com/corp/worldwide/

recommender system.

•

•

We

apply

sentence-embedding

technique3.1. Dataset(Doc2vec model) to the data, and build the

We collect user log data from one of Rakuten sub markets.

user-to-item recommender system. Doc2vec

It also offers a huge range of products from various

model give us a vector for each item, or user.

merchants. The log data is collected from January till

We use the item vectors from both embedding

October 2015. It contains click through data, and purchasemodels to build an additional user-to-item

history data. Each record in the log data corresponds to a

recommenderuser ’s action, such as “search” or “view ” or etc. The click

system,namelyItem

Vector-based. We then compare our results withthroughconventional approaches, e.g., collaborative

submitting a search query, to clicking on web pages offiltering methods.

items, or scrolling on those web pages; while the purchase

data

is

the

user ’s

behavior

rangingfromhistory is recorded in the transaction logs. By separating

2. Applying

Distributed

Representation

two kinds of data, we can analyze user ’ behavior

Approach to Recommender Systems

effectively and further increase the performance ofBased on the idea of utilizing cosine distance torecommendation results.

measure the similarity between items, or users and items,

Figure 2 shows some properties of the dataset such as

we apply distributed representation approach to build ourlength of sessions and number of sessions per user. The

recommender systems. We use the log data from one ofleft chart is the distribution of sessions’ length. In our

Rakuten markets to generate the item sequences. Eachdataset, more than 60% of users’ sessions contain only one

item sequence is a user ’ session. Therefore, a user may

single request (user interacted with only one item). The

have several sessions, at different dates and times.

chart on the right indicates the distribution of session

In Word2vec, or Doc2vec model, a document is acount in the dataset. More than 50% of users visited thesequence of words with their context. In order to build

site once and did not come back in a long time. These

recommenderasimportant statistics help us understand the data, and give

documents, and items as words in those documents/users’

us some hints on how we should generate the users’

sessions. Each user has a sequence of item views withsequences, and tune the parameters when training thehis/her intention. See Figure 1 for our approach.

embedding model.

systems,

we

treat

users’

sessions

Figure 2: Dataset property

Figure 1: Distributed representation of users and items

From the original data, we generate the item sequences,

3. Item-to-Item Recommender System
Given an item, the target of an item-to-item recommenderand use them to train the Word2vec model. The user ’ssystem is to show relevant items to that item. In thiscookie from each record is utilized to identify the uniquesection,item-to-item

user. First, we group records with the same user ’s cookie.

recommender system using the Word2vec model. We

Each sequence is a user ’s session. It is a list of items thatcalled it Word2vec-based system. First, we explain how wethe user interacted with. Each session lasts less than 2generate the data for training Word2vec model. Then, wehours. It is called the time interval between users’ sessions,use the trained model to find the similar items given awhich can reflect user's preference changes over a period

particular item.

of time. Therefore, a particular user may have multiple

we

show

the

resultsofoursessions.
Figure 3 illustrates our method for generating the users’sequences from user log data. We sort the items in eachmeasure the similarity between two items, we calculate thesession by the timestamp that users performed theircosine distance between their item vectors. Here, theactions, and split users' items into sessions to generate thebigger the cosine value is, the more similar the two items

item sequences. In order to build the item-to-item

willrecommender system, we use only the order of items in

Word2vec-based

sessions, and ignore the user information.

result for two kinds of data: click through data, andbe.

Figure4shows

item-to-item

anexamplerecommender

of

our

system’spurchase history data. The first row is the search query,while the others are top-5 similar items to the query.
ToevaluatetheWord2vec-based

item-to-item

recommender system, we find top-15 similar items to all
the items that have item vectors from Word2vec model,
and visualize them by putting the items’ images on a 2D
plane. Figure 5 illustrates our visualization for some of theitems.

Figure 3: Users’ sequences generated from user log data

3.2. Word2vec-based System
Functionally, the item-to-item recommender systemtakes an item as input, and outputs a set of similar items
given the input. In order to give the item candidates,
similar items are ranked from highest to lowest score, andtop-n items with the highest scores will be stored as theoutput for the item-to-tem recommender system.
We train the Word2vec model using the item sequencesin Section 3.1. Here, each item in sessions corresponds toa word in sentences. We keep only the meaningful sessions

Figure 4: An example of our item-to-item recommenderthat have at least N items, and experimentally set N = 3.

system’s results

To avoid redundancy and reduce the training time, we also
remove consecutive duplicate items in sessions, e.g.,
session"itemA

itemB

itemB

itemA

itemC"

willbeconverted to "itemA itemB itemA itemC".
We use the skip-gram architecture to train the Word2vec
model, and experimentally set the parameter value asfollows:
Parameter
Size

Values300

Explanation
Vector dimension
Maximum
numberWindow
8
words/items of context
Numberof“noiseNegative25
words/items” should be drawn(train faster)Sub-samplingoffrequent
Sample1e-4
words/items
Items appear less than thisMin-count3
min-count value is ignored
Iteration
20
Training iterations
Table 1: Parameter settings for training Word2vec model
Word2vec model gives us one vector for each item. To

Figure 5: Visualization of our item-to-item recommendersystem’s results, for some items

4. User-to-Item Recommender System
The goal of a user-to-item recommender system is tosuggest relevant items to an individual user based on its

knowledge of the user ’s behavior. That is, given a user,

to the item-to-item recommender system, we keep all thethis recommender shows relevant items to the user. In thisitems and consecutive duplicate items in sessions tosection, we present the results of two user-to-item

increase the item quantity, and take into account the items

recommender systems. The first system is based on thethat are viewed/purchased multiple times.

similarity between all user vectors and item vectors fromWe also use the skip-gram architecture to train theDoc2vec model, whereas the latter system infers new item

Doc2vec model, and experimentally tune the parametercandidates from user ’s history items, and ranks theirvalues as in Table 2. The combination of the following

average similarities to the history items set. We also

parameters is considered: size, window, negative, sample,

compare our results with conventional approaches, such as

min-count, and iteration. We then perform a grid search tocollaborative filtering methods.

find the optimal parameters and the best performance forour user-to-item recommender system.

4.1. Dataset
and testing data. Training set contains the data from

Parameter
Size
Window

Values[50, 100, 200, 300, 400, 500]
[1, 3, 5, 8, 10, 15]January to August 2015, while testing set is the data in

Negative[0, 5, 10, 15, 20, 25]

September and October 2015. We generate the users’

Sample[0, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7,
1e-8]

Min-count[1, 2, 3, ..., 20]

We split the log data into two separated sets: training

sequences from the training data. This is similar to Section
3.1. Then, we build the user-to-item recommender systems
from training data, and evaluate our new systems on thetesting set. Note that, we use both the order of items in

Iteration[10,15, 20, 25, 30]
Table 2: Parameter settings for Doc2vec model(Bold values are the best settings)

sessions, and the user information (their cookies) for
building the user-to-item recommender systems.

Our Doc2vec-based user-to-item recommender systemachieved a hit-rate of 18.21% for 13,995 users with the

4.2. Evaluation Method
Our evaluation metric is similar to the one introducedby Deshpande and George (2004). The performance ismeasured by looking at the number of hits within the
top-N items that were recommended by our user-to-item
recommender system [1]. The number of hits is thebest settings shown in the above table. After that, we tune
each parameter to inspect the best setting for each of them,
and

find

the

importantparametersthataffectrecommender ’s performance. The experiment results areanalyzed in Figure 6.

number of items in the testing data that were also present
in the top-N recommended items returned for each user. If
n is the total number of common users in training andtesting data, the hit-rate of the recommendation algorithm
is computed as:
hit-rate (HR) =!"#$%& () *+,.

In all of experiments we set N = 20 as the number of
items top be recommended by the recommender system. A
hit rate of 1.0 indicates that the system was able to always
recommend the relevant item, whereas 0.0 indicates thatthe system was not able to recommend any of the relevant
items.

Figure 6: Parameter optimization for Doc2vec model

4.3. Doc2vec-based System

All the best settings for parameters result in the bestuser-to-item

performance (hit-rate), except min-count. If min-countrecommender system from the training data in Section 4.1.

value is increased, e.g., min-count=5, the hit-rate will be

Each item in sessions corresponds to a word, and eachhigher. However, the item quantity will be significantly

user ’s cookie corresponds to a sentence label. In contrast

reduced. We therefore, set min-count value to 3 forWedeveloptheDoc2vec-based

keeping the balance between the number of items and theitems, and add them to the candidates set. In oursystem’s performance. Figure 6 shows the impact ofcase, we set n to 20.

parameters Doc2vec model. Interestingly, min-count had
little effect on our recommender system's hit-rate, while•

Next, we calculate the score for each pair of user
and item, denoted by SCORE(U, i), where j is an

sample and size are two most important parameters that

item in the candidates set. SCORE(U, i) is

control the performance.

computed as:

We compare our results with conventional approaches,
including item-similarity based similarity [10] method and

SCORE(U, i) =matrix factorization [11]. The item similarity based model𝒋∈𝑼𝒊𝒕𝒆𝒎𝒔 𝑺𝒊𝒎(𝒊,|𝑼𝒊𝒕𝒆𝒎𝒔 |𝒋),first computes the similarity between items using thewhere i is an item candidate, j is an item inobservations of users who have interacted with both items.

history items set, and |𝑈=>?@A | is the number ofGiven a similarity between item i and j, it scores an item jhistory items. This score is the average cosine

for user u using a weighted average of the user ’s previous

similarity between each item in the candidates set

observations. There are server choices of similarity
function to use, e.g., ‘Jaccard’, ‘cosine’ or ‘pearson’. In
our case, we choose ‘Jaccard’ to compute the item
similarities.

Matrixfactorization

methodisand history items.
•

Finally, we rank items’ scores, and keep top-N
similar items that have highest scores. We set N

another

to 20 and use these items as the recommended

well-developed method in recommendation scenario. This

items for that user. For example, in figure 7, only

model tries to learn latent factors for each user and item

items in the red eclipse will be recommended forand then uses them to make recommendations.

the user.

The first three columns in Figure 8 show the hit-rate oftwocollaborative

Doc2vec

based

Doc2vec-based
performed

filteringbased

system.

It

user-to-item

significantly

systems,

indicates

ourmodel in Section 3.2 for calculating items’ scores. Testingthat

recommender

betterthan

We leverage the item vectors from pre-trained Word2vec

and

our

data and test users are the same with the data used tosystemevaluate our Doc2vec user-to-item recommender system;

twotherefore we can compare their results in terms of hit-rate

thosecollaborative filtering based recommender systems, with ascore.

hit-rate of 18.21% compared to 3.42%, and 8.02%. Our
new system has proved to be effective by significantly
improving the hit-rate score.

4.4. Item Vector-based System
We also use the item vectors from Word2vec/Doc2vec
model to build an additional user-to-item recommender,
namely Item Vector-based system. Figure 7 provides anexample of our item vector-based system. We develop asystem based on the assumption that each user has a list ofitems that he/she interacted with in the training data,
called history items, and each item is represented as ann-dimension vector from Word2vec/Doc2vec model. Then,our recommender system will find the similar items given
history items calculate and rank their scores to keep themost confident items for a particular user. The details of
our approach are described in the following:•

Figure 7: Illustration of item vector-based system
Figure 8 shows the performance of various user-to-item
recommender systems. Our new item vector-based system

Each user has history items in the log data. They

achieved of 21.04% when recommending for 13,907 /are

13,995 (99.4% user coverage), with the Word2vec’s item

used

to

infer

item

candidates

forrecommendation, which are similar items given
those history items. We get item vectors from
Word2vec/Doc2vec model, choose top-n similar

vectors.

Figure 8: Performance of user-to-item recommendersystems
We also use the item vectors from Doc2vec model
instead of Word2vec model. The experiments showed thatour proposed systems achieved a hit-rate of 24.17% forrecommending items to 13,981 / 13,995 users (99.9% user
coverage) in testing data, and outperformed conventional
approaches.

5. Conclusion and Future Work
In

this

paper,

we

focusedon

item-to-item

anduser-to-item recommender systems. We developed the
distributed representation-based recommender systems,
and applied that approach to the dataset from one of
Rakuten markets. Experiment results illustrated that our
proposed systems achieved a hit-rate of 24.17% forrecommending

items

to

users

in

testing

data,

and

outperformed collaborative filtering methods.
In future work, we plan to evaluate the distributed
representation-based recommender systems based on otherdatasets, such as from Rakuten Ichiba, one of the largest
e-commerce site in Japan.

References[1] Deshpande,
Mukund,andGeorgeKarypis.
"Item-based top-n recommendation algorithms."
ACM Transactions on Information Systems (TOIS)
22.1 (2004): 143-177.
[2] Konstan, Joseph A., et al. "GroupLens: applying
collaborative
filteringtoUsenetnews."
Communications of the ACM 40.3 (1997): 77-87.
[3] Le, Quoc V., and Tomas Mikolov. "Distributed
representations of sentences and documents." arXiv
preprint arXiv:1405.4053 (2014).
[4] Lops, Pasquale, Marco De Gemmis, and Giovanni
Semeraro. "Content-based recommender systems:
State of the art and trends." Recommender systems
handbook. Springer US, 2011. 73-105.
[5] Mikolov, Tomas, et al. "Distributed representationsof words and phrases and their compositionality."
Advances in neural information processing systems.
2013.
[6] Pazzani,
MichaelJ.,
andDanielBillsus.

"Content-based recommendation systems." Theadaptive web. Springer Berlin Heidelberg, 2007.
325-341.
[7] Resnick, Paul, et al. "GroupLens: an open
architecture for collaborative filtering of netnews."
Proceedings of the 1994 ACM conference on
Computer supported cooperative work. ACM, 1994.
[8] Sarwar, Badrul, et al. "Item-based collaborative
filtering recommendation algorithms." Proceedingsof the 10th international conference on World Wide
Web. ACM, 2001.
[9] Schafer, J. Ben, et al. "Collaborative filtering
recommender systems." The adaptive web. Springer
Berlin Heidelberg, 2007. 291-324.
[10] Francesco Ricci, Lior Rokach, and Bracha
Shapira. Introduction to recommender systems
handbook. Springer US, 2011.
[11] Koren,
Yehuda,Robert
Bell
and
Chris
Volinsky. “Matrix Factorization Techniques for
Recommender Systems.”Computer Volume: 42,
Issue: 8 (2009): 30-37.