# Enhancing Short-Term Sales Prediction with Microblogs: A Case Study of the Movie Box Office
## 3 Framework of the Microblog-Based Short-Term Sales Prediction
### Sentiment Analysis
According to the trained topic model, we can get the topic distribution and the word distribution of topics, which are denoted as \(p(z_{t}|m)\) and \(p(n|z_{t})\), respectively. Given a document \(m\), if we select a topic \(z_{t}\) with the probability \(p(z_{t}|m)\), then the topic with the maximal probability is most likely to be the topic that the document is associated with. Let the document topic be \(z_{t_{max},m}\), which can be represented as \(z_{t_{max},m}=\underset{t}{argmax}(z_{t}|m)\). To make the description clearer, we summarize all notations used in our framework in Table 1.  
For each word \(n\) in a document \(m\), the probability of this word belonging to a topic \(z_{t}\) is \(p(z_{t}|m,n)\). Then, the main topic with the maximal probability can be regarded as the most suitable topic that the word \(n\) belongs to. Thus, we define the main topic of a word \(n\) within a document \(m\): \(z_{t_{max},m,n}=\underset{t}{argmax(z_{t}|m,n)}\). As all the words belonging to the same topic of a document have the same word distribution, we can know that \(p(n|z_{t},m)\) equals \(p(n|z_{t})\). Therefore, according to the Bayesian conditional probability formula, we have the following equation: \((z_{t}|m,n)=\frac{p(n|z_{t})*p(z_{t}|m)}{p(m,n)}\), based on which we can transform \(z_{t_{max},m,n}\) into the following equation: \(z_{t_{max},m,n}=\underset{t}{argmax(n|z_{t})*p(z_{t}|m)}\). Basically, if the main topic of a word is similar to the main topic, the word is closer to the document's main topic. Therefore, the sentiment polarity of the word contributes more to the sentiment polarity of the document. Based on such analysis, we propose to use the Cosine similarity to measure the similarity between two topics, e.g., \(z_{t_{1}}\) and \(z_{t_{2}}\), which is defined by Formula (1). Here, \(\sum\limits_{n=1}^{N}p(n|z_{t})=1,t=t_{1},t_{2}\). \[similarity_{z_{t_{1}},z_{t_{2}}}=\frac{\sum\
olimits_{n=1}^{N}p(n|z_{t_{1}}) p(n|z_{t_{2}})}{\sqrt{\sum\
olimits_{n=1}^{n}p_{(n|z_{t_{1}})}^{2}}\sqrt{ \sum\
olimits_{n=1}^{n}p_{(n|z_{t_{2}})}^{2}}} \tag{1}\]  
As each word \(n\) has different impacts within a document \(m\), we define the weight of a word \(n\) within a document \(m\) by Formula (2), where \(\sum weight_{m,n}=1\). \[weight_{m,n}=\frac{similarity_{z_{t_{max},m},z_{t_{max},m,n}}}{\sum\
olimits_{ n=1}^{N}similarity_{z_{t_{max},m},z_{t_{max},m,n}}} \tag{2}\]  
The sentiment polarity of a word in a sentiment dictionary is usually classified into three states, namely positive, negative, and neutral. Formula (3) shows the definition of sentiment polarity. \[senti_{n}=\left\{ \begin{array}{rl}&1\ n\ \text{is a positive word.}\\ &0\ n\ \text{is a neutral word.}\\ &-1\ n\ \text{is a negative word.}\\ \end{array} \right. \tag{3}\] \begin{table}
\begin{tabular}{c c} \hline \hline
**Notation** & **Description** \\ \hline \(m\) & A document, which refers to a microblog in this paper. \\ \hline \(n\) & A word in a microblog \\ \hline \(z_{t}\) & A topic in a microblog \\ \hline \(N\) & The word count of a document \\ \hline \(similarity_{z_{t_{1}},z_{t_{2}}}\) & The similarity between two topics : \(z_{t_{1}}\) and \(z_{t_{2}}\). \\ \hline \(senti_{n}\) & The sentiment polarity of the word \(n\). \\ \hline \(senti_{m}\) & The sentiment polarity of the microblog \(m\). \\ \hline \(d\) & A day \\ \hline \(pd_{d}\) & The proportional difference between positive and negative sentiment within the day \(d\). \\ \hline \(influ_{m}\) & The influence of the microblog \(m\). \\ \hline \(norm\_influ_{m}\) & The normalized influence of the microblog \(m\). \\ \hline \(sif_{m}\) & The social influence of the microblog \(m\). \\ \hline \(inf_{d}\) & The social influence of the microblog within the day \(d\). \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Notations used in our method. Based on the sentiment polarity of each word in a document, we can define the sentiment polarity of the document.