DEIM Forum 2017 P6-2

Collaborative Hotel Recommendation based on Topic and Sentiment ofReview Comments
Zhan ZHANG† and Yasuhiko MORIMOTO†† Graduate School of Engineering, Hiroshima University
Hiroshima University Higashi-Hiroshima 739-8521 Japan
E-mail: †{m154277,morimo}@hiroshima-u.ac.jp
Abstract We considered a method for recommending hotels in this paper. Most of conventional hotel recommendation systems use a vector space model to represent hotels. A hotel recommendation system decides attributes
such as service, location, price, etc. in the vector space. In such system-defined fixed vector space, it is diﬃcult tocapture personal preference and evaluation viewpoint well, since each user has her/his preferences and viewpoints
that are diﬀerent from axis of the system-defined vector space. Therefore, we proposed a method that can automatically decide attributes of vector space. In most of systems, users can submit natural language comments, in whichusers can express various impressions about hotels. Therefore, in our method, we have utilized natural language
comments that have submitted by users. We, first, analyzed texts in comments by using Latent Dirichlet Allocation(LDA) and extracted representative topics about hotels from the tex ts automatically. We further analyzed thetexts to find sentiment for each extracted topic for each hotel. By using the topic and sentiment information, we
generated our recommendations.
Key words Hotel recommendation(ホテル推薦),Collaborative Filtering(協調フィルタリング), Sentiment Analysis(センチメント分析),LDA(LDA).

1. INTRODUCTION

as age, price, star rating, and so on, and other subjective values, such as service quality, food, that are comes from users’

Recently, many travelers use travel websites when theyevaluation sheets. In such system-defined fixed vector space,select a hotel. Most of travel websites have functions for rec-it is diﬃcult to capture personal preference and evaluation

ommending hotels for travelers who are looking for a hotel.

viewpoint well, since each user has her/his preferences andIn this paper, we consider a hotel recommendation method

viewpoints that are diﬀerent from axis of the system-definedthat takes into account sentiments of review comments as

vector space. Therefore, we proposed a method that can

implicit ratings for hotels.

automatically decide attributes of vector space.

There are several approaches of hotel recommendation.

In order to capture each users’ personal preferences andOne of the most successful approaches is Collaborative Fil-

viewpoints, we use natural language comments of users. We,

tering (CF). There are two kinds of CF. One is user-based

first, analyzed texts in comments by using Latent Dirichlet

CF. The other is

CF. Given a user, the user-

Allocation (LDA) and extracted representative topics about

based CF first finds similar users of the user and then rec-hotels from the texts automatically. We further analyzed theommends items that the similar users like to the user. On

texts to find sentiment for each extracted topic for each hotel.

the other hand, item-based CF computes similar items that

By using the topic and sentiment information, we generated

the user liked and recommends the similar items.

our recommendations.

item-based

Most of conventional hotel recommendation systems, including CF, use a vector space model to represent hotels. In

In more details, we propose a two-phase scheme which generates hotel vectors for each hotel automatically.

a vector space model, a hotel is a record of an m-dimensional

In the first phase, the hotel vector space is defined via

table where m is the number of attributes such as price, rat-

LDA. LDA is a simplest topic model, where is used to dis-ing, distance, and so on. In the vector space model, thecover a set ofschema of the model is defined by a recommendation sys-and infer topics for unclear document.

tem. For example, each travel web site provides fixed hotel

method, LDA extracts latent topics from user’s review com-

profiles, which include hotel’s demographic information, suchments given in TripAdvisor. We regard latent topic space as

topicsfrom a large collection of documents
In our purposed

hotel vector space to represent hotels.

of whole sentences based on the sentence structure, computes

In the second phase, the hotel vectors are generated forthe sentiment based on how words compose the meaning ofeach hotel by referring the sentiment of each topic in its re-longer phrases. The performance is better than all previ-

view comments. A hart work for us is to assigns sentimentous methods is indicated by several experiments in EMNLP

to topics respectively in a review. In general, the sentimentpaper.

might diﬀer in a review. To assign sentiment to topics cor-

2. 3 Hotel Recommendation systems

rectly, it is necessary to split review into some smaller parts.

Hotel Recommendation systems has attracted attention in

Based on our observation, one sentence tends to represent

the past few years. The CF has been explored in travel [9]one topic and one sentiment in reviews. Jo Y and Oh AH [4]with the hotels of making recommendations to users. The

developed a review analysis model based on sentiment andsimilar users or items are identified using a similarity metricaspect for online review. They assume all words in a sin-[10]. There are two methods used for make recommendation:

gle sentence are generated from one aspect and demonstrate

Topic-K [11] and similarity thresholding [12].

that such assumption holds up well in practice. Therefore, In

A lot of studies use a vector space model to represent ho-

the review analysis step, we infer the topic and analysis thetels, and use the text of reviews as its main data. Suchsentiment to generate topic-sentiment pair for each sentence.

as [1], The attributes of hotel vector space are manually de-Aggregate such sentiment and topic pair as the result of re-noted into several aspects such as food, services, sleep and soview analysis. Finally, hotels are represented as a vectors

on. After that, they find representative words form reviews

based on the result of its reviews analysis.

and classify the words into each aspect. Finally, Hotel vector

The performance of proposed scheme is evaluated via experiment. In the experiment, we use a data set collected

are generated based on the result of such textual analysis ofreviews.

from TripAdvisor. the result of experiment indicates that

Some studies extract the sentiment form reviews to rep-

the performance of our proposed method is better than Item

resent hotels as a vector. In existing work [8], They pro--based CF and User-based CF.

pose recommendations using a combination of features. theThe remainder of this paper is organized as follows. Sec-

built hotel aspects and extracting sentiment assign to each oftion 2 overviews related works. Section 3 describes the details

them, by using additional knowledge such as nationality orof the proposed scheme. Section 4 shows Implementation andpurpose of trip built the profile of users. [13] build user pro-

Evaluation. Finally, concludes the paper with future work

files from users’ review texts and use these profiles to filterin section 5.

other review texts with the eyes of this user.

2. RELATED WORKS

3. PROPOSED METHOD

2. 1 Latent Dirichlet Allocation

In this section, we describe the detail of proposed method

Topic modeling provides a suite of statistical tools to dis-to provide a recommendation of hotel for a user based on re-cover latent semantic structures from complex corpora, withview comments. The proposed method consists of two parts,

latent Dirichlet allocation (LDA) as the most popular one.

one is hotel vector generation, the other one is Item-based

It is an example of a topic model and was first presented as

Collaborative Recommendation.

a graphical model as Figure 1 for topic discovery by DavidThe main feature of our proposed method is that it gener-

Blei in 2003[3]. After training topic model, LDA represents

ates hotel vectors for each hotel automatically. Hotel vector

documents as mixtures of topics that spit out words withspace definition and hotel vector generation is represented

certain probabilities. Based on such mixtures, it is capablein section 3.1 and 3.2 respectively. The detail of Item-basedof inferring topics of document. Nowadays, LDA is a widely

Collaborative Recommendation is represented in section 3.3.

used topic model in NLP. It has found many applications in

3. 1 Hotel Vector Space definition

text analysis, data visualization, recommendation systems,

Let H = {h1 , h2 , . . . , hN } denote a set of hotels to be cov-

information retrieval and network analysis.

ered by the proposed method. We defined a Hotel Vector

2. 2 Stanford CoreNLP toolSpace with |K|-dimensions. Given a collection of reviews as-

The Stanford CoreNLP tool provides a set of natural lan-sociated with set H, the Hotel Vector Space is designed as

guage analysis tools, it is including the part-of-speech (POS)
tagger, the named entity recognizer (NER), the parser, andthe sentiment analysis tools.

follows.
At first, we set the parameter of topic’s number as K. Let
T = {t1 , t2 , . . . , tK } denote a set of topics are automatically

Stanford CoreNLP provides a new deep learning model toextracted by LDA in reviews. We regarded such topics as as-

analyze the sentiment. It actually builds up a representation

pects of hotels and defined that each topic is correspondingto a dimension of our hotel vector space to represent hotelreasonably.
3. 2 Hotel vector generation
This subsection shows how to map hotel into a point in the
Hotel Vector Space. For a given hotel hn ∈ H, we denote
−
→
→
→
→
the vector of hotel h as V hn = {−s ,−s ,...,−
s→}, where −
s
n

1

2

K

k

denotes the value of dimension in Hotel Vector Space. In the→paper, the value −s is calculated by referring the sentiment

Figure 1 Example review from TripAdvisor.com

kof each topic in its review comments. At first, we extract
hotel hn ’s review comments rn = {rn1 , rn2 , . . . , rnM } from
TripAdvisor, let M be the number of comments and rnm be

P (Sr |tk ) =∝∏P (Wi |tk ) · P (tn |rk )(3)

Wi ∈Sra review which belongs to hn . For a comment rnm ∈ rn , thekey issue for us is to assigns sentiment to topics respectively.

Where P (Wi |tk ) is given by Topic-word frequency-based

we split comment rnm into sentence. For each sentence Sr ,matrix from LDA, and P (tk |rm ) is also calculated by LDA

we generate topic-sentiment pair as ⟨tsr , S⟩, where tsr is theas well.

topic and S is the sentiment of sentiment Sr . The sentiment

Example. Figure 2 depicts an example to illustrate theof each topic in comment rm is calculated by aggregation of

topic inference phrase. Figure 2 gives a review which con-such topic-sentiment pair.

sists several sentence.To infer the topic of sentence 3 which is

Although LDA is powerful to infer the topics of reviews, it

Dinner was delightful and delicious. For each topic, we com-is weak to infer the topic of a sentence since the size of sen-pute P (Sr |tk ) by Formula (4.3) to calculate the probability.

tence is too small (i.e., lack of words). Therefore, we cannot

For topic 0, we compute P (Sr |tk ) as follows:

infer the topic for each sentence by LDA directly.
Recall that K denotes the number of topics, and T denotes the set of topics extracted by LDA. Let P (tk |rm ) be
the probability of a review rm concerns with topic tk . With

P (Sr |tk ) = P (WD inner|t0 )·P (Wd elightf ul|t0 )·P (Wd elicious|t0 )·P (t0 |rm )= 0.08 · 0.02 · 0.09 · 0.425 = 0.00068

the above notions, Similar with the topic prediction process
in [4,6], we infer the topic of given sentence Sr by following

Similarly, we calculate the probability with condition of eachequation:

topic. After that, according to (4.2), we choose the highest
one as tsr (e.g., the topic of sentence Sr ). In this case, theP (Sr |tk ) =∏P (Wi |tk ) · P (tk |rm ) · P (rm )topic of sentence 3 is topic 0.
(1)

Wi ∈Sr

We calculate S of topic-sentiment pair ⟨tsr , S⟩ for each sentence Sr by Stanford CoreNLP tool. In Stanford CoreNLP

where

tool, the sentiment is represented by a label which belongs to

P (Sr |tk ) denotes the probability that the sentence Sr be-very negative, negative, general, positive, very positive. Herelongs to Topic tk .
∏Wi ∈Sr P (Wi |tk ) denotes the probability that the words
Wi of Sr belong to Topic tk , and P (tk |rm ) denotes the probability that Topic tk belongs to review rm .
P (rm ) is the probability that review is chosen from the setof reviews, which is a constant.

we transform such label into a value S in {1, 5}, e.g., very
negative to be 1, negative to be 2, etc.
For given hotel hn , we denote the vector of comment−→
rnm ∈ rn as V r = {s1, s2, . . . , sK}, where sk denotes the−→value of dimension of comment vector V r , it is calculated
by average of topic-sentiment pair ⟨tsr , S⟩. we group ⟨tsr , S⟩

Since we assume that, all words in a single sentence are

by tsr ∈ {1, 2, . . . , K}, and sk is calculated by average of S

generated from one topic, therefore, we calculate probability

in each group. Note that: sk is defined as 0, If there are not

P (Wi |tk ) of each topic tk ∈ {t1 , t2 , . . . , tK }, and choose theone which has highest probability value of P (Sr |tn ) as the
topic of sentence tsr . tsr is determined as follows:

mention about topic tk in the review.
Example: Figure 3 give us several topic and sentiment pair−→in a review. The example shows how to calculate V r
s1 : (3 + 5 + 4) ÷ 3 = 4

tSr = argmax{P (Sr |tk )|tk ∈ {t1 , t2 , . . . , tK }}(2)

Since P (rm ) is a constant, we ignore P (rm ) and rewrite
the Formula (3) as follows:

s2 : 3 ÷ 1 = 3
s3 : 3 ÷ 1 = 3...
−→r
V = {4, 3, 3, . . . , sK }

Table 1 The part of LDA topic model(topic)no.

words

1

check,call, desk, arrive, phone, charge, service . . .

2

Guest, claim, problem, issue, service, clean . . .

3Walk, view, restaurant, shopping, taxi, breakfast . . .

4

Airport, car, shuttle, drive, night, parking, pay . . .

5Breakfast, food, buﬀet, dinner, meal, order, caf? . . .

Figure 2 Fig.3. Example for aggregate topic and sentiment pair

6

Bar, place, drink, wine, feel, enjoy, people . . .

7

Suite, Bed, TV, kitchen, shower, tub, sink, door. . .

−→→→Recall that, V hn = {−s1 , −
s2 , . . . , −s→K } denotes the hotel vec-

...

...

tor of hotel hn ∈ H, rn denotes the related review of hotel−→
hn . hotel vector V hn is calculated by aggregate of review−→rvector V which are belong to rn . The value of each dimen→sion −
s is compute by following equation,

4. IMPLEMENTATION AND EVALUATIONk

In this section, we conducted three experiments to evaluate
∑

−
→
sk =

→
−r
V ∈R

the performance of proposed scheme using actual Tripadviosr

sk /I(if I =
| 0)
(4)

−
→
sk = 0(if I = 0)

dataset which download from DAIS（注 1）. First as the implementation phase, we represent our apprehension about topic
model generated by LDA and the details of our dataset. After that we examine the eﬀect of topic’s number to find the

where

−
→
sk is the Sentiment value of Topic tk in V r .

best parameter settings. In each experiment we explain ourI denote the frequency of tk appearance in reviews set rn .

method eﬀect to the recommendation evaluated by MAE and3. 3 Item-based Collaborative Recommendation

RMSE.

In this section, we introduce how to make recommenda-

4. 1 Datasettion for a user. In order to perform Top-N recommendation

We used from TripAdvisor as data source. TripAdvisor isfor user u, we compute the estimated rating for every un-

an authoritative travel website providing hotel ranking andrated hotel. It consists of two phases. In the first phase, we

information. Ten thousands of members are share their re-compute the similarity of hotels based on hotel vector. In

views in this website every day. The content of our dataset

the second phase, we predict the rating of unvisited hotel tois including rating and review for each record. Our dataset

user.

contains 2256 reviews. The data density is about 3.57%.

The similarity between hotel hi and hj is measured by co−→−→sine of the angle between hotel vectors V hi and V hj . The

4. 2 Implementation
Preprocessing include Tokenizing, stemming, removing

similarity is denoted by sim(hi , hj ) and it is calculated bystop words. We can easily perform preprocessing of reviews

following equation,

data by Stanford CoreNLP tool. To generate LDA topic
model, we using the JGibbLDA which is a LDA open source

−
→hi −
→
−
→ −
→
V · V hj
Sim(hi , hj ) = cos( V hi , V hj ) = −
2
2
→
−
→
|| V hi || · || V hj ||for Java. Table1 shows the extracted topic when we set the(5)

topic’s number is 30. As we can see that, the topic 1 andtopic 2 is related to service, topic 3 and topic 4 is related towhere ′′ ·′′ denotes the dot-product of the two vectors. The

Location, topic 6 and topic 7 is related to room. . .

value of similarity is more near to 1, the hotels is more sim-

4. 3 Parameter Settings

ilar.

To examine the eﬀect of topic’s number for make prediction

Let rb denote the prediction of User uj to unvisited hotelhi .

LetHjube the set of hotels which is rated by uj . The

prediction of rating rb of uj to unvisited hotel hi is given by:of rating. We use two common quantities: root-mean-squareerror (RMSE) and mean absolute error (MAE) with diﬀerent
parameter settings K = {10, 15, 20, 25, 30, 35, 40}.
MAE measure how close predictions are to the eventual

∑
rb =

u
u sim(hj , hi ) · ruj ,hu
hu
j
j ∈Hj

∑

u
u (|sim(hj , hi )|)
hu
j ∈Hj

outcomes, and the formula as follows:
(6)

Where
huj denote a hotel belongs to Hju .

（注 1）：[7] http://www.dims.ne.jp/timelyresearch/2008/080908/

Figure 4 The avgerge of RMSE

Figure 3 The avgerge of MAE

1 ∑|ri − rb|
N i=1
N

M AE =(7)

Where, the N denote that the number of prediction. ri
denote the real rating and rbi denote the prediction of rating.
RMSE measure of the diﬀerences between values (sample
and population values) predicted by a model or an estimatorand the values actually observed, the formula as follows:
v
u N
u1 ∑
RM SE = te2
n i=1 j(8)

Figure 5 The result of Evaluation

We divide data into two sets, one is train data set and the

0.891919, User-based KNN is about 0.87518. RMSE of ourother one is test data set. Train set contains 80% of all data

proposed method is about 0.869774758 and Item-based KNN

and remaining data are used for test data set. For each trial,

is about 1.175592, Item-based KNN is about 1.148296.

we implement 5 times and compute the averages of themto make sure the result is believable. Figure 3 shows theoverall performance with diﬀerent K = 5, 10, . . . 40. For our
method, we pick k=30; Figure 4 shows the performs when
we fix K=30 compared with user-based CF and item-based
CF.

With the experimental result, it is demonstrated that our
method works eﬀectively for providing recommendation.

5. CONCLUSION AND FUTURE WORKIn this paper, we have proposed a hotel recommender system that takes into account sentiments of review comments

In figure 3 we study the eﬀect of the parameter K, andas implicit ratings for hotels. The first experiment showed

the improvement is best when the K=30. The reason is asthat topic’s number have an eﬀect on accuracy of recommen-

follows. Too little cannot infer the topic of reviews. How-

dation. The result of the second experiment indicated that

ever, when K becomes large, one topic may be divided in to

our method works eﬀectively for hotel recommendation.

several topics more than one. That will raise an error too.

As future work, we will try to find better method to infer

4. 4 Evaluations

topic for a sentence. Also with an improvement of recom-

To evaluate the performance of our proposed method, we

mendation method, we wish that more accurate results cancompare MAE and RMSE of our method with Item-based
collaborative filtering and User-based filtering which are popular techniques of the Recommendation Systems. We use

be obtained in later work.

6. ACKNOWLEDGMENT

ItemKNN[11] to implement the item-based CF method, sim-Firstly, I would like to show my deepest gratitude to myilarly use UserKNN to implement the user-based CF method.

supervisor, Dr. Morimoto Yasuhiko. Also, my thanks go to

As we see from Figure 4, the performance of our proposedlaboratory member. And I am also grateful to my boyfriend

our proposed method is better than both item-based CF
and user-based CF. In more detail, MAE of our proposed
method is about 0.674798202 and Item-based KNN is about

who gives me a lot of supports both on lift and study.

References[1] Hu Y H, Lee P J, Chen K, et al, “HOTEL RECOMMENDATION SYSTEM BASED ON REVIEW AND CONTEXT INFORMATION: A COLLABORATIVE FILTERING APPRO,” 2016.
[2] Zhang J D, Chow C Y, Zheng Y, “ORec: An opinion-based
point-of-interest recommendation framework,” Proceedingsof the 24th ACM International on Conference on Information and Knowledge Management, pp. 1641–1650. 2015.
[3] Blei D M, Ng A Y, Jordan M I, “Latent Dirichlet Allocation,” Journal of Machine Learning Research, pp. 993-1022.
2003.
[4] Jo Y, Oh A H, “Aspect and sentiment unification model for
online review analysis,” Proceedings of the fourth ACM international conference on Web search and data mining,ACM
pp.815-824. 2011.
[5] Socher R, Perelygin A, Wu J Y, et al. “Recursive deepmodels for semantic compositionality over a sentiment treebank,” Proceedings of the conference on empirical methods
in natural language processing (EMNLP). pp. 1631–1642.
2013.
[6] Arora R, Ravindran B., “Latent dirichlet allocation based
multi-document summarization,” Proceedings of the second
workshop on Analytics for noisy unstructured text data.
ACM, pp: 91-97. 2008[7] http://www.dims.ne.jp/timelyresearch/2008/080908/.
[8] Levi A, Mokryn O O, Diot C, et al, “Finding a Needle ina Haystack of Reviews: Cold Start Context-Based Hotel
Recommender System,” 2012.
[9] Zheng, Y., Burke, R., & Mobasher, B, “Diﬀerential Context
Relaxation for Context-Aware Travel Recommendation. In
Artificial Intelligence Review,” pp. 88?99.2012[10] Pappas, N., & Popescu-Belis, A, “Combining content withuser preferences for non-fiction multimedia recommendation: a study on TED lectures. Multimedia Tools and Applications,” 2015.
[11] Sun, J., Wang, G., Cheng, X., & Fu, Y, “Mining aﬀective
text to improve social media item recommendation. Information Processing & Management,”2014.
[12] Zheng, Y., Burke, R., & Mobasher, B, “A hotel recommendation system based on collaborative filtering and Rankboost algorithm,” 2010 International Conference on MultiMedia and Information Technology, MMIT, pp.317?320.
2010.
[13] Zhang Y, Lai G, Zhang M, et al, “Diﬀerential Context Relaxation for Context-Aware Travel Recommendation. In Artificial Intelligence Review,” pp. 88?99.2012[14] Zhang Y, Lai G, Zhang M, et al, “ Explicit factor models
for explainable recommendation based on phrase-level sentiment analysis,” Proceedings of the 37th international ACM
SIGIR conference on Research & development in information retrieval. ACM, pp.83–92. 2014.