{'fraction_non_alphanumeric': 0.03565696741329984, 'fraction_numerical': 0.007954783336822273, 'mean_word_length': 4.7581357975090395, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Latent Sentiment Detection in Online Social Networks: A Communications-oriented View

In this paper, we consider the problem of latent sentiment detection in Online Social Networks such as Twitter. We demonstrate the benefits of using the underlying social network as an Ising prior to perform network aided sentiment detection. We show that the use of the underlying network results in substantially lower detection error rates compared to strictly features-based detection. In doing so, we introduce a novel communications-oriented framework for characterizing the probability of error, based on information-theoretic analysis. We study the variation of the calculated error exponent for several stylized network topologies such as the complete network, the star network and the closed-chain network, and show the importance of the network structure in determining detection performance.


I. INTRODUCTION
Online Social Networks (OSN), such as Twitter 1 have come to heavily influence the way people socially galvanize. Recent world events such as the Arab Spring, witnessed cascading democratic revolutions characterized by a strong reliance on online social media such as Twitter and Facebook [1]. Today there are about 554,750,000 registered active Twitter users with about 135,000 new Twitter users signing up everyday. Around 58 million tweets are tweeted per day and the website attracts over 190 million visitors every month [2]. Such staggering numbers have turned such OSN into a veritable data gold mine for organizations and individuals who have a strong social, political or economic interest in maintaining and enhancing their clout and reputation. Therefore, extracting and analyzing the embedded sentiment in the microblogs (or Tweets) posted by the tweeters about these organizations or individuals, or specific issues, products and events related to them or their competitors, is of great interest to them. Of particular interest is the latent sentiment (as opposed to individual expressed sentiments), which can be either positive or negative with respect to a particular position. We explain this latent sentiment in detail in Section II. Strict length restrictions (such as the 140 character-limit per tweet), irregular structure of the microblog content and the usage of sarcasm renders the problem of automatic latent sentiment detection (classifying latent sentiment as positive or negative) from the microblog contents error-prone. As evidenced in literature [3], [4], sentiment detection has been approached from an engineering perspective with the main focus being on sentiment detection algorithms, followed by empirical performance comparisons using standard datasets such as Stanford Twitter Sentiment (STS) dataset and the Obama-McCain Debate dataset [5].We had considered in [6], network aided detection of votes in the senate harnessing the joint press release network. In this paper, we approach such problems from a relatively scientific perspective.That is, we attempt to answer the following two important questions regarding social-network aided latent sentiment detection.
1) How much benefit can be expected by using the social network for latent sentiment detection?
2) How does the social network structure affect the performance of network-aided sentiment detection?
Towards this end, we use a stylized model of latent sentiment detection, based on a Markov Random Field model. We then analyze the performance of the optimal Maximum Aposteriori Probability (MAP) sentiment detector, keeping in mind the underlying social network structure.
For this, we are inspired by a communications-oriented viewpoint, where we view the underlying network as providing a weak channel code, that transmits one bit of information. Accordingly, we are able to analyze the performance of the sentiment detector, by borrowing tools from information theory. We can then compute and contrast the performance under various stylized social network topologies, thus providing answers to both the questions posed above. Thus, we show that communication theorists can contribute to the growing field of social network analysis.
The rest of the paper is organized as follows. In Section II, we describe the latent sentiment detection problem, introduce the formal model and motivate its relevance through real-world scenarios based on Twitter. We also specify the optimal MAP sentiment detector. In Section III, we perform a communications-oriented analysis of the MAP sentiment detector to derive an upper bound on the detection error probability, in terms of an error exponent. We also show how the exponent can be evaluated numerically for various stylized topologies such as the complete network, the star network and the chain network. In Section IV, we present numerical results that show how the error exponent depends on the network topology and other social network parameters. We conclude the paper in Section V.

A. Model
The model considered in this paper is shown in Fig. 1. Let x ∈ {−1, +1} n be the vector of expressed sentiments of the n members of a social network, with x(i) ∈ {−1, +1} being the expressed sentiment of the i th member/node. The social network structure is modeled as an undirected graph G(V, E) characterized by its symmetric adjacency matrix A. It may be obtained using the follower/followee relationships, or in some cases, using the @-mentions in the tweets [7]. The graph is undirected since we will use it to model correlation, rather than influence flows. The sentiments are assumed to be sampled from an underlying homogeneous Markov Random Field (MRF) [8] with unit edge potential and inverse temperature parameter, θ. In this paper, we assume θ ≥ 0, so that we are restricting ourselves to attractive/ferromagnetic models, which correspond to homophilic networks. In such a ferromagnetic model, the neighboring nodes positively correlate with each other, so that the distribution has more probability in configurations with similar values on the nodes of the graph. Let t ∈ {−1, +1} indicate the latent sentiment variable which homogeneously influences every node of the network as a local field of strength γt. In the absence of any sentiment bias, we assume t to be equi-probably equal to +1 or −1.
Thus, the conditional distribution of x given t, can be written as, Notice that from the communications perspective, x is a codeword randomly chosen in response to bit t. Let y be a noisy estimate of x. It may be estimated from the features extracted from the user profiles or could even be the sentiment vector estimated by a given classifier algorithm, such as the ones in [3] and [4]. While the alphabet of each y(i) can be arbitrary, in this paper, for simplicity, we assume that it is binary {−1, +1}. We model y to be the output of n-identical and independent Binary Symmetric Channels (BSCs) characterized by the equal cross-over probability p bsc , with the elements of the true sentiment vector x as the input.
Therefore, the conditional distribution, p(y|x) may be written as, where ε = 1 2 log p bsc 1−p bsc and c = 2 cosh(ε). The joint distribution of all variables may now be written as,

B. Real-world examples from Twitter
The model (3) is applicable to several real-world latent sentiment detection scenarios. We begin by assuming that there exists a latent sentiment (t ∈ {−1, +1}), which will cause a The intention is to predict this real-world event in the present using the expressed sentiments gathered from the twitterverse (y in our model). Thus, it is the same as detecting the value of t (hence the term latent sentiment detection). to the act amongst the conservatives.
The goal would be for an automatic sentiment detector to predict t for each network. Of course, in this example, one can do this knowing the political stance of the networks, which is side information. However, automatic detection aims to apply a general method based detector on y without requiring human intervention through specialized side information.

C. MAP sentiment detector
We assume that the network adjacency matrix A and the other system parameters, θ, ǫ, γ are known. Then, the optimal MAP latent sentiment detectort, which is equal to the Maximum Likelihood (ML) detector in this case, iŝ where, the likelihood l(y) is, In the next section, we analyze the performance of the optimal MAP sentiment detector (5).
We perform a communications-inspired analysis of the probability of error of the detector, using which, we seek to understand the contribution of the social network, as well as the role played by the underlying network topology in the performance of the detector.

III. COMMUNICATIONS-INSPIRED ANALYSIS OF SENTIMENT DETECTION
In this section, we perform an analysis of the error probability of the latent sentiment detector (5). By symmetry of the model, the error probability is, Here, 1(A) = 1 for the event A, otherwise it is 0.P e is infeasible to calculate for large social network. So, in the next subsection, we present an upper bound for P e .

A. P e upper bound
The main result of this paper is the following theorem. Theorem 1: For the optimal MAP detector (5), an upper bound on the error probability P e is, Proof: The proof relies on Information-theoretic analysis.(See Appendix).

B. Computation of the upper bound
From (8), we see that computation of the upper bound requires computing the partition functions related to the underlying MRF. This is an NP-complete problem in general [12].
However, for certain stylized topologies, such as the complete network, the star network and the (closed) chain network and others, there exist closed form expressions for the partition function.
We compute the partition functions in closed form for these topologies and list them below.
Thus the error probability upper bound (8) can be evaluated for the above network topologies, to provide insight into the impact of social network structure on the sentiment detector performance.
Note that, via (8), we have reduced the complicated problem of computing an error probability to a problem of calculating an MRF partition function. The partition function calculation is a well researched problem in MRF theory [13], [14] [15], and significant effort has been expended in statistical physics and machine learning to compute it for a variety of graphs. Thus, our theorem facilitates importing ideas from that literature to obtain the error probability bound for a variety of graphs.

C. Error exponent
For large networks, an error exponent can be defined as, Using the bound (8), we can show that, α ≥ log(cosh(ε)) + log(Z(θ,γ)) For the simple case where the network is absent, α can be shown to be exatly, Thus, we can use (13) as a benchmark to compare error exponents obtained for various network topologies via evaluation of (12). In the following section, we perform these comparisons by plotting the variation of the error exponent α derived in (12) and (13) with respect to the model parameters, θ, γ and ε.

IV. NUMERICAL RESULTS: ERROR EXPONENT OF DIFFERENT NETWORKS
The aim of this section is to answer the two questions raised in the Introduction. First, to show how much improvement can be expected when the network is used for detection and secondly, to understand the effect of network topology on MAP detector performance. We do this by plotting (12).
The inverse temperature parameter, θ, captures how strongly opinions are correlated in the network. Increasing θ increases the homophily in the OSN, which makes the underlying MRF more strongly ferromagnetic. For example, nodes of a particular political party will be strongly homophilic.This is exploited by the network aided sentiment detector in (5), resulting in faster increase of α for network aided detectors with increasing θ,as shown in Fig. 4, with ε = 0.5 and γ = 0.5. As seen, α for the no-network (i.i.d.) scenario remains invariant to the change in θ while for the network-aided cases, we see α → log(cosh(ε)) = 0.1201 as θ increases. The rate of increase of α is clearly the highest for the complete network case when compared to the star and chain networks.Notice also that the complete network reaches the maximum α beyond a certain threshold θ since it is strongly homophilic.
The parameter γ captures how strongly the latent sentiment influences the opinions of the users/nodes. Practically, large γ pertains to a highly emotive situation where the users are strongly influenced to take a particular position even in the absence of strong homophily (θ). Since γ is independent of the network effect, both the No-net and the network-aided detectors can harness the effect of increase in γ resulting in higher α in both scenarios. However, the combined use of the network as well as γ results in higher α for the network aided cases. This behavior is seen in Fig. 5. The other system parameters were held constant (ε = 0.5 and θ = 0.5). Again, α → log(cosh(ε)) = 0.1201 as γ increases similar to Fig. 4.
Finally, we turn out attention towards Fig. 6 which shows the variation of α with ε for θ = 0.5 and γ = 0.5. −ε captures the amount of noise in the BSC in dB (with ε → ∞ being the zeronoise case). Alternately, ε is the accuracy of the detector used to obtain estimated individual sentiments, y. As expected, increase in ε results in higher α for both network-aided and the no-network cases. In all cases, the error exponent α of the complete network is significantly larger than the star and the chain networks. Through this, we have attempted to provide insight into the role played by the network, specifically the topology, in lowering the probability of error of detection, thereby rigorously characterizing the worth of the network as an additional information source for sentiment detection.
Firstly, we motivate the practical scenarios where the model is applicable and then provide an analysis of the upper bound on the probability of error, or equivalently, the error exponent .
By optimizing over the function s(y), it is possible to write a tighter upper bound, by using (4). Here, E (·) denotes expectation with respect to x, conditioned on t = −1 (see (1)).
Now, setting b = be (which would loosen the bound) and using the identity e T x (cosh(ε)) n .
We can finally expand the expectation within the minimization to produce the upper bound: