<?xml version="1.0"?><!DOCTYPE article SYSTEM "/project/take/software/searchbench_offline_processing/paperxml_generator/aclextractor/src/python/../resource/dtd/paperxml.dtd"><article><header><firstpageheader><page local="1" global="89"/><title>A Sentiment Detection Engine for Internet Stock Message Boards</title><author surname="Chua" givenname="Christopher"><org  name="YY Technologies" country="USA" city="Mountain View"/></author><author surname="Milosavljevic" givenname="Maria"><org  name="University of New South Wales" country="Australia" city="Sydney"/></author><author surname="Curran" givenname="James R."><org  name="University of Sydney" country="Australia" city="Sydney"/></author></firstpageheader><frontmatter><p><b>A Sentiment Detection Engine for Internet Stock Message Boards</b></p><p><b>Christopher C. Chua tt        Maria Milosavljevic </b>*        <b>James R. Curran </b>**</p><p>School of Computer Science Capital Markets CRC Ltd * School of Information</p><p>and Engineering"<footnote anchor="1"/>" Technologies *</p><p>University of New South Wales       55 Harrington Street University of Sydney</p><p>NSW 2052, Australia            NSW 2000, Australia NSW 2006, Australia</p><p>{cchua,maria}@cmcrc.com james@it.usyd.edu.au</p></frontmatter><abstract>Financial investors trade on the basis of infor­mation, and in particular, on the likelihood that a piece of information will impact the mar­ket. The ability to predict this within millisec­onds of the information being released would be useful in applications such as algorithmic trading. We present a solution for classifying investor sentiment on internet stock message boards. Our solution develops upon prior work and examines several approaches for selecting features in a messy and sparse data set. Us­ing a variation of the Bayes classifier with fea­ture selection methods allows us to produce a system with better accuracy, execution perfor­mance and precision than using conventional Naïve Bayes and SVM classifiers. Evaluation against author-selected sentiment labels results in an accuracy of 78.72% compared to a hu­man annotation and conventional Naïve Bayes accuracy of 57% and 65.63% respectively. </abstract></header><body><section number="1" title="Introduction"><p>In this paper, we present a sentiment prediction en­gine for classifying investor sentiment, i.e. sig­nals to buy, sell or hold stock positions, based on messages posted on internet stock forums. Our sentiment annotated corpus comes from HotCop-per<footnote anchor="1"/>, the most popular investment forum for the Australian market, where posts include author self-reported sentiment labels. This unique character­istic of this data set present us with an opportu­nity to extend research in sentiment classification.</p><footnote label="1">http://www.hotcopper.com.au</footnote><p>Our automated sentiment detection engine imple­mentation uses variations classifiers, particularly the Bernoulli Naïve Bayes and the Complement Naïve Bayes (cnb) models, coupled with feature selection techniques using InfoGain, phrase polarity counts and price alerts. Our methods achieve 78.72% ac­curacy for cnb and 78.45% for Bernoulli. These figures are higher than the 57% accuracy from hu­man annotators and 65.63% in the baseline. It also outperforms results from Das and Chen (2007) on a different dataset.</p></section><section number="2" title="Problem Domain"><p>Our results contribute towards the development of a real-time solution which monitors financial informa­tion in order to provide useful advice to support mar­ket surveillance analysts' task of explaining alerts surrounding price movements in stocks. For exam­ple, when the overall sentiment towards a particular stock is positive, it may well explain the observed increase in its uptake. Many forums do not pro­vide an ability for authors to explicitly report sen­timent, thus we hope to eventually apply this model to other forums. The "Buy", "Hold" and "Sell" tags are analogous to positive, neutral and negative senti­ments respectively. HotCopper also includes a finer-grained labeling system for "short term" and "long term" sentiments. However such distinctions are be­yond our current scope because a finer granularity in the recommendation strength given limited contex­tual information is often established through an in-depth knowledge of underlying financial fundamen­tals or information related to a particular stock not reflected within a short message text.</p><page local="2" global="90"/><p>Classifying investor sentiment based on web fo­rum messages is a challenging problem in the text classification domain. The dataset is not only sparse, but varies in the overall quality of its labels and de­scriptive content. For instance, the sentiment labels are likely to vary in a thread from one post to an­other, which indicates disagreement. Previous work on sentiment classification is based around relatively well-formed texts (Durant and Smith, 2006; Pang et al., 2002). As demonstrated in Milosavljevic et al. (2007), information extraction techniques such as sentence boundary detection and part-of-speech tag­ging work relatively well on structured texts but per­form less well on messy and sparse data sets such as forum posts and interview transcripts. Hence, we re­quire the use of techniques beyond conventional ap­proaches. Furthermore, the constraints of a real-time classification system presents additional challenges.</p></section><section number="3" title="Background"><p>As the literature directly related to this domain is limited, we draw from related areas of sentiment classification research where a research efforts have been concentrated around sentiment or opinion anal­ysis for political blogs (Durant and Smith, 2006) and product reviews (Yi et al., 2003). The methods de­veloped in those prior work are relevant to our appli­cation.</p><p>Sentiment analysis on web forums specifically within the financial domain has also been investi­gated by Das and Chen (2007). Their focus, like ours, is on capturing the emotive aspect of the text rather than the factual content. In their research, the Naïve Bayes (nb) classifier is found to yield the best results, and a voting mechanism is used in conjunc­tion with additional classifiers such as svm to im­prove accuracy. However, the classification accu­racy achieved at 62% using a simple majority vote of multiple classifiers with a small sample and the low inter-annotator agreement demonstrate the dif­ficulty in classifying such datasets. Antweiler and Frank (2004)'s research findings found that online forum discussions between investors are not equiva­lent to market noise, and instead contain financially-relevant informational content. As a result, effective sentiment detection can predict market volume and volatility across stocks, thus highlighting the need for placing such web discussions under the inves­tigative eyes of surveillance analysts. Both Das and Chen (2007) and Antweiler and Frank (2004) use data from Yahoo Finance and Raging Bull based in the US, covering only a subset of stocks, with classi­fication performed per stock rather than in aggregate.</p><p>The prior literature demonstrates that the senti­ment analysis task can be performed using a va­riety of classification methods, chief among them the nb model (Das and Chen, 2007; Antweiler and Frank, 2004). Similar to Das and Chen (2007) and Antweiler and Frank (2004), we find that a typical svm classifier performs no better than the alterna­tives we attempted, while suffering from a higher de­gree of complexity affecting execution performance. Moreover, prior solutions presented do not offer a comprehensive sentiment analyser to predict senti­ment off financial forums in real-time for market surveillance or technical trading. We extend the con­cepts presented in prior research by incorporating ad­ditional contextual information in our training tasks, developing more advanced feature selection as well as adopting variations of the models used in related research.</p><doubt alpha="66.7" length="6" tooSmall="False" monospace="0.0">4 Data</doubt><p>In our analysis, we use the first six months of 2004 HotCopper asx stock-based discussions. There are 8,307 labeled posts across 469 stocks, with an av­erage of 28 words per post and a total of 23,670 dis­tinct words in the dataset. Each message is organised by thread, with a single thread consisting of multi­ple posts on the same topic for a stock. We con­sider both long term and short term variations of a sentiment to be equivalent. "Buy" recommendations outnumber "Sell" and "Hold" 13.6 and 4.4 times re­spectively. Within first 18 months of our analysis, the average monthly posts increased from over 1,400 to a peak of over 3,700 posts by August 2005, indi­cating growing forum participation. Discussions on HotCopper mainly surrounds speculative stocks, par­ticularly those in minerals exploration and energy. In fact, some of the biggest stocks by market capitali­sation on the asx such as the Commonwealth Bank (cba) and Woolworths (wow) generate little to no active discussions on the forums, highlighting the fo­cus on small and speculative stocks.<page local="3" global="91"/></p><table caption="Table 1: HotCopper Post Statistics" class="main" frame="box" rules="all" border="1" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>Statistic</p></td><td class="cell"><p>Buy</p></td><td class="cell"><p>Sell</p></td><td class="cell"><p>Hold</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>Total</p></td><td class="cell"><p>6379</p></td><td class="cell"><p>469</p></td><td class="cell"><p>1459</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>Monthly Average</p></td><td class="cell"><p>1063.17</p></td><td class="cell"><p>78.17</p></td><td class="cell"><p>243.17</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>Monthly Std Dev</p></td><td class="cell"><p>283.65</p></td><td class="cell"><p>28.22</p></td><td class="cell"><p>50.95</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><subsection number="4.1" title="Data Preprocessing"><p>We perform a series of preprocessing steps for each post to obtain a canonical representation, firstly by removing stop words from the training set in the nltk stop list (Bird et al., 2009). Words and al­phanumerics of non-informative value, e.g. "aaaaaa" or "aaaaah", are filtered out, the remaining stemmed using the Porter algorithm (Porter, 2009) with spell-correction applied using the first suggestion from the PyEnchant package (Kelly, 2009).</p><p>We observed many ambiguous instances which in­troduce noise to the training model. In order to control for this, a thread volatility measure is in­troduced for the message where we assign an in­dex value representing the level of disagreement be­tween subsequent replies in the thread. The thread volatility is measured as the average sum of the dif­ferences between the discretised values of the sen­timent classes. We assign buy and sell to have the furthest distance, thus the discretised set S contains {buy=1,hold=2,sell=3}. Threads which transitions from buy to sell result in a higher volatility fig­ure than threads which transitions from buy to hold. This allows for the posts within a thread with lower volatility to emerge as a superior sample. The thread volatility measure for a discretised sentiment si in thread t with <i>Nt </i>posts, is defined as follow:</p><doubt alpha="33.3" length="9" tooSmall="False" monospace="0.0">1Nt-14i=1</doubt><p>We select threads with low volatility (&lt; 0.5) for our training base in order to reduce the level of disagree­ment in the training set. This filtering step reduces our effective sample size to 7,584 and enhances the quality of the training sample.</p></subsection></section><section number="5" title="Classification"><p>Our first experiment consisted of a baseline nb clas­sifier (McCallum, 1998). The nb classifier follows Bayesian probability theory in selecting the maxi­mum likelihood of an outcome given its prior proba­bilities. We are interested in the most probable class</p><p>(map), given a message instance d with n features f and set of sentiment classes <i>S:</i></p><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">n</doubt><p><i>MAP = </i>arg max <i>P</i>(s) <b>TT </b><i>P(fi\s)</i></p><doubt alpha="33.3" length="3" tooSmall="False" monospace="0.0">i=1</doubt><p>A simplifying assumption is to treat the presence of individual features in the message <i>d </i>containing <i>n </i>words as positionally-independent of other words in the document. Although weakly-formed, this is found to perform well due to its zero-one loss prop­erty (Domingos and Pazzani, 1997). Laplace's add-one smoothing method is used to account for zero probabilities.</p><p>Following this, we tested an adapted version of the nb classifier to improve our classification accu­racy, by incorporating the Term Frequency Inverse Document Frequency (tf-idf) transformation (Ren-nie et al., 2003), which allows us to weigh terms that provide a greater distinction to a particular post more heavily than ones which appear with regular frequency across all posts and are poor features to rely on for classification.</p><p>Another issue that we have to contend with is the uneven class distribution in the dataset, which is a common issue in text categorisation. Undersampling or oversampling methods results in an inaccurate dis­tribution of underlying data, hence to overcome this limitation, we apply the approach used by Rennie et al. (2003) to tackle this skewness. The cnb classifier improves upon the weakness of the typical nb clas­sifier by estimating parameters from data in all senti­ment classes except the one which we are evaluating for. For a given message j with n features f, the cnb classifies documents according to the following rule:</p><doubt alpha="56.5" length="23" tooSmall="False" monospace="0.0">1(f ) = arg minV"fiW.Si</doubt><doubt alpha="66.7" length="6" tooSmall="False" monospace="0.0">sESf—*</doubt><p>fi is the count of feature <i>i </i>in the post and wSi is the complement weight parameter which is the tf-idf transformed complement of the likelihood estimates (see Rennie et al. (2003)).</p><p>Finally, we also tested the classifier performance with the Bernoulli model of Naïve Bayes (McCal­lum, 1998), which replaces feature frequency counts with Boolean values. The use of the cnb classifier<page local="4" global="92"/></p><p>Classifier nb Baseline cnb cnb ig nb Binarised nb Binarised ig</p><doubt alpha="29.5" length="61" tooSmall="False" monospace="0.0"># of Features 7,200 7,200 1205 (Rank 50) 7,200 1205 (Rank 50)</doubt><doubt alpha="18.6" length="43" tooSmall="False" monospace="0.0">Accuracy 65.63% 74.41% 78.72% 75.75% 78.45%</doubt><doubt alpha="20.5" length="44" tooSmall="False" monospace="0.0">Precision 68.50% 74.80% 76.70% 70.30% 73.40%</doubt><doubt alpha="14.6" length="41" tooSmall="False" monospace="0.0">Recall 65.60% 74.40% 78.70% 75.80% 78.50%</doubt><doubt alpha="14.3" length="42" tooSmall="False" monospace="0.0">F-score 66.90% 74.50% 77.50% 72.00% 72.00%</doubt><table caption="Table 2: Results Summary"></table><p>and Bernoulli variant yields a statistically significant improvement in the classification accuracy, which is consistent with the findings of Pang et al. (2002) in the sentiment analysis domain.</p></section><section number="6" title="Feature Selection"><p>The features are irst ranked by order of frequency. An optimal set of features is selected by testing fea­ture increments up to a maximum of 10,000 fea­tures; approximately 40% of the base. We then tested the information gain (infoGain) algorithm (Yang and Pedersen, 1997), which is useful in il-tering out the vast number of features to a man­ageable subset. Among the additional features we incorporate is the count of positive and negative bigrams and trigrams (including negations) of the form "adj financiaLterm" where financial terms are common phrases encountered within the sample such as "EPS", "dividends" and "profit" represent­ing domain-speciic knowledge. Another domain-speciic feature we incorporate is the count of stock price alerts in the 3 days preceding the start of a thread. A price risefall alert is triggered when the stock price risesdrops beyond 4 standard deviations from its historical price change levels.</p></section><section number="7" title="Results and Evaluation"><p>in any machine learning task, it is crucial to verify our results against human agreement levels. We took a random sample of 100 opening posts (to avoid out of context replies) and published an annotation task using Amazon's Mechanical Turk (MTurk) (Ama­zon, 2009) to obtain classifications from three paid annotators who passed a test. The disappointingly low annotator accuracy of 57% and Kappa agree­ment of 50% demonstrates the challenging nature of this task, even for humans.</p><p>We perform each experiment using 10-fold cross-validation and compare the performance based on ac­curacy in conjunction with F-scores. Table 2 summarises our main findings in terms of sentiment clas­sification quality. At 7,200 features, the best perfor­mance is seen in the cnb and Bernoulli classifiers. in both schemes, infoGain attribute selection im­proved F-scores by 10.60% and 5.10% respectively with 1,205 features compared to the baseline. The overall accuracy of both classiiers, at 78.72% and 78.45% are signiicantly above those attained in the baseline.</p><p>Our results reveal two classification strategies in our implementation, i.e. using either the cnb or the Bernoulli nb model. We also ind that feature se­lection techniques and iltering noisy instances with the volatility measure, increase overall performance to a level higher than that of the baseline. Positive and negative phrase counts do not yield signiicant improvements in performance, which could be ex­plained by a change in sentiment tone as evidenced in Pang et al. (2002). For example, a post may be la­beled "Sell" but contain positive messages unrelated to the subject. This may be improved by using entity recognition to disambiguate context. Further exten­sion that we hope to incorporate into the classiica-tion model is the addition of inancial information reported in the media to help augment information not reflected in the message board post.</p></section><section number="8" title="Conclusion"><p>We introduce a sentiment prediction engine that al­lows for the real-time classiication of sentiment on internet stock message boards. Through the applica­tion of alternative models and additional feature se­lection schemes, we are able to achieve classiication F-score of up to 77.50%. We believe that more ad­vanced natural language processing techniques, par­ticularly deeper contextual analysis using external sources of inancial data as well as improving the handling of imbalanced classes, will provide fruitful grounds for future research.</p><page local="5" global="93"/></section><references><p>Amazon. 2009. Amazon Mechanical Turk. http:// aws.amazon.com/mturk.</p><p>W. Antweiler and M.Z. Frank. 2004. Is All that Talk just Noise? The Information Content of Internet Stock Message Boards. <i>Journal of Finance, </i>pages 1259­1294.</p><p>S. Bird, E. Loper, and E. Klein. 2009. Natural Language Toolkit. http://www.nltk.org.</p><p>S.R. Das and M.Y. Chen. 2007. Yahoo! for Ama­zon: Sentiment Extraction from Small Talk on the Web. <i>Journal of Management Science, </i>53(9):1375-1388.</p><p>P. Domingos and M. Pazzani. 1997. Beyond Indepen­dence: Conditions for the Optimality of the Simple Bayesian Classifier. <i>Machine Learning, </i>29(2-3):103-130.</p><p>K.T. Durant and M.D. Smith. 2006. Mining Sentiment Classification from Political Web Logs. In <i>Proceedings of Workshop on Web Mining and Web Usage Analy­sis of the 12th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (WebKDD-2006), Philadelphia, PA.</i></p><p>R. Kelly. 2009. PyEnchant Spellchecker. http://</p><p>www.rfk.id.au/software/pyenchant/.</p><p>A. McCallum. 1998. A Comparison of Event Models for Naïve Bayes Text Classification. In <i>AAAI Workshop on Learning for Text Categorization, </i>pages 41-48.</p><p>M. Milosavljevic, C. Grover, and L. Corti. 2007. Smart Qualitative Data (SQUAD): Information Extraction in a Large Document Archive. In <i>Proceedings of the 8th RIAO Conference.</i></p><p>B. Pang, L. Lee, and S. Vaithyanathan. 2002. Thumbs Up?: Sentiment Classiication using Machine Learn­ing Techniques. In <i>Proceedings ofthe ACL conference on Empirical Methods in Natural Language Process­ing, </i>volume 10, pages 79-86. Association for Compu­tational Linguistics.</p><p>M. Porter. 2009. The Porter Stemming Al­gorithm. http://tartarus.org/ -martin/ PorterStemmer/.</p><p>J.D. Rennie, L. Shih, J. Teevan, and D. Karger. 2003.</p><p>Tackling the Poor Assumptions of Naïve Bayes Text Classiiers. In <i>Proceedings ofthe Twentieth Interna­tional Conference on Machine Learning, </i>pages 616­623.</p><p>Y. Yang and J.O. Pedersen. 1997. A Comparative Study on Feature Selection in Text Categorization. In <i>Pro­ceedings ofthe Fourteenth International Conference on Machine Learning, </i>pages 412-420.</p><p>J. Yi, T. Nasukawa, R. Bunescu, W. Niblack, I.B.M.A.R.</p><p>Center, and CA San Jose. 2003. Sentiment Analyzer: Extracting Sentiments about a Given Topic using Nat­ural Language Processing Techniques. In <i>Third IEEE</i> <i>International Conference on Data Mining, </i>pages 427­434.</p></references></body></article>