Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

A special feature of online communities is the frequent occurrence of collective emotions, which are not so easily observable in offline interaction. Spontaneously, large amounts of users share similar emotional states, due to their ability to reach many other users in a quick, and often anonymous way. Such collective emotions can result from exogenous as well as from endogenous causes. For example, external events, such as a catastrophe or a large marketing campaign, are able to trigger the online expression of emotions of millions of users. But collective emotions can be also created within online communities, in various forms such as memes in social networks (Leskovec et al. 2009), heated discussions in forums (Chmiel et al. 2011), and cascades of emotions in microblogs (Alvarez et al. 2015).

The increasing importance of online communication not only changes the way people interact everyday, but also offers a great chance to retrieve and analyze large amounts of data on human behavior. Everyday, millions of Internet users leave online traces that are publicly accessible, in the form of comments, video downloads, or product reviews. The unprecedented size of these datasets allows the quantitative testing of previous theories and hypotheses formulated in the social sciences, for example about social influence (Onnela and Reed-Tsochas 2010; Lorenz 2009), cooperation, and trust (Walter et al. 2009).

Furthermore, sentiment analysis techniques (Thelwall et al. 2013) allow the analysis of the emotions expressed through the Internet. For example, the emotional content of millions of Twitter messages has been used to study the daily patterns of mood (Golder and Macy 2011), and the assortativity of happiness in social networks (Bollen et al. 2011). Our aim is to study emergent collective emotions, as their dynamics and preconditions can be studied based on the textual expressions of users in online communities. Interestingly, one finds a large degree of regularity in such online phenomena. For example, the lifetime of a forum discussion can be related to the level of negative emotions expressed in it (Chmiel et al. 2011). This opens the question about the mechanisms that lead to such collective emotional states.

Online data allows us to measure how and when collective emotional states emerge, but the analysis of this spontaneous behavior cannot be simply reduced to the activity of single users. Instead, these collective states should be treated as emergent phenomena resulting from the interaction of a large number of individuals. In our approach, we relate the statistical regularities observed in online communities to the interactions between users. The distinction between the micro level of individual users and the macro level at which their collective behavior can be observed is one of the specific features of the theory of complex systems. Over the last 40 years methods and tools from computer science, statistical physics, and applied mathematics have been utilized to address this micro-macro link and to predict the collective dynamics of a system from individual interactions of many system elements, or agents.

To study collective emotions, we need an appropriate description of the agents and their interactions, but we also need an appropriate framework to predict the collective dynamics of the system from its basic ingredients. Without such a framework, we are only left with extensive computer simulations of multi-agent systems, in which, for given assumptions of the interactions, we have to probe the entire parameter space, to find out the conditions for certain collective phenomena. Furthermore, collective emotions appear in different online communities, which often have different interaction mechanisms. Models of collective emotions in each of these communities, if designed and analyzed separately, might shed light on the particular properties of collective emotions in each one of them. Such approach, on the other hand, would not allow to draw conclusions on universal properties of collective emotions across communities. If designed within a unifying framework, models of collective emotions in different communities can be compared between different scenarios of online interaction.

In this chapter, we present a framework to describe collective emotions in online communities through agent-based models. In an agent-based model, we first need to describe the emotional states of individual agents, which should be based on insights obtained in psychology. We follow Russell’s representation of core affect (Russell 1980), modeling emotions as short-lived psychological states of the individual. This established theoretical perspective is based on two dimensions: valence, indicating whether the emotion is pleasant or unpleasant, and arousal, indicating the degree of activity or inactivity induced by the emotion. Therefore, the internal states of our agents will be composed of two independent variables of valence and arousal. Previous research has already analyzed the dynamics of individual valence and arousal (Kuppens et al. 2010), proving that agent-based models are useful for research in psychology (Smith and Conrey 2007).

2 The Cyberemotions Modeling Framework

Our framework is specific enough to allow analytical results to predict simulation outcomes (Schweitzer and Garcia 2010), but general enough to cover a wide range of online emotional interactions. The main feedback loops of this framework, as sketched in the left panel of Fig. 10.1, are comprised of two orthogonal layers: an internal layer describing the agent (shown horizontally) and an external layer describing the communication process (shown vertically). In the internal layer, the arousal a and the valence v of an agent determine its emotional expression s, which reaches the external layer by contributing to the communication field h. The latter one has its independent dynamics and can, in addition to contributions from other agents, also consider input from external sources, I. The causality loop is closed by considering that both valence and arousal of an agent are affected by the communication field.

Fig. 10.1
figure 1

Left: Schema of the components of the modeling framework. Right: Sample trajectories of valence of ten agents in a simulation

Since we are interested in modeling the emotional dynamics of Internet communities, this general framework can be easily adjusted to consider the particularities of various online platforms such as user expression limitations, external influence on users, communication in networks as opposed to broadcast, etc. In the following, we describe the framework and provide different examples of how to specify our modeling framework to cope with different online communities.

2.1 Brownian Agents

Our modeling framework is based on the principle of Brownian Agents, where each agent is a person interacting in the online medium. This modeling principle was successfully applied other contexts, describing the dynamics of opinions (Schweitzer and Hołyst 2000) as well as a large variety of other systems, from urban growth and economic agglomeration, to chemical pattern formation and swarming in biological systems (Schweitzer 2003). Brownian agents are described by a set of K state variables u i k, where the sub-index i = 1, , N refers to each individual agent i, and the super-index k = 1, , K refers to each variable. These variables could be external if they can be observed in empirical data, or internal if they can only be indirectly concluded from the observable data. Each of these state variables can be time dependent due to interaction with the agent’s environment, or due to internal dynamics that do not require external influence. In a general way, we can formalize the dynamics of each state variable u i k as a superposition of two influences of different nature:

$$\displaystyle{ \frac{d\,u_{i}^{k}} {dt} = f_{i}^{k} + \mathcal{F}_{ i}^{\mathrm{stoch}} }$$
(10.1)

This formulation is based on the principle of causality: the change in time of any variable, noted as \(\frac{d\,u_{i}^{k}} {dt}\), is produced by some causes which are listed on the right hand side of the equation. In the case of Brownian agents, these causes are assumed to be described by a superposition of deterministic (f i k) and stochastic influences (\(\mathcal{F}_{i}^{\mathrm{stoch}}\)).

The stochastic term models all the influences on the variables that are not observable on the time and length scale of the available data. This stochastic term does not direct the dynamics of the agent state in any particular direction, and it is commonly, but not necessarily, modeled by white noise. Furthermore, the strength of the stochastic influences might be different among agents, depending on local parameters of the agents, as in Schweitzer (2003).

The deterministic term f i k represents all the specified influences that change the corresponding state variable u i k. For example, nonlinear interactions with other agents can be modeled as a function that depends on the state variables of any set of agents, which can also include agent i itself. f i k can also describe the agent’s response to the available information, which is the case for our modeling framework. Additionally, f i k can reflect the eigendynamics of the agent, which are the changes in the variables u i k not caused by any influence external to the agent. Examples of eigendynamics are saturation or exhaustion, common in the modeling of human behavior (Lorenz 2009; Kuppens et al. 2010). In order to design a multiagent system, we have to define the agent’s state variables, u i k, and the dynamics of their change, f i k, specifying the interaction among agents. These dynamics are defined at the level of the individual agent and not at the collective level, in a way that the macroscopic dynamics emerge from the interaction of many agents, just as collective emotions emerge in online communities from the interaction of many users.

2.2 Emotional States and Their Internal Dynamics

Following the bidimensional representation of core affect (Russell 1980), we quantify the emotional state of an agent through the variables of valence v i (t), and arousal a i (t). As explained in Chap. 5, these two variables are known to capture most of the information of emotional experience, and represent the level of pleasure and activity associated with an emotion. In our model, we define the state of the agent as e i (t) = { v i (t), a i (t)}. Note that valence and arousal are internal variables, i.e. cannot be directly observed on the agent. They can only be indirectly observed, for example through physiological measurements or individual reports.

In the absence of interaction emotions relax to an equilibrium state. This is supported by empirical studies that show how emotional states exponentially decay (Kuppens et al. 2010). This relaxation, e i (t) → 0, implies v i (t) → 0, a i (t) → 0. Thus, following Eq. (10.1), we define the dynamics of the Brownian agent as follows:

$$\displaystyle\begin{array}{rcl} \frac{d\,v_{i}} {dt} & =& -\gamma _{vi}\,v_{i}(t) + \mathcal{F}_{v} + A_{vi}\;\xi _{v}(t) \\ \frac{d\,a_{i}} {dt} & =& -\gamma _{ai}\,a_{i}(t) + \mathcal{F}_{a} + A_{ai}\,\xi _{a}(t){}\end{array}$$
(10.2)

The first terms on the right-hand side of the equations describe the exponential relaxation of valence and arousal towards the equilibrium state. The parameters γ vi and γ ai define the time scales of this relaxation, which can be different for valence and arousal and across agents. The second terms describe the deterministic influences as explained below, and the third terms model the stochastic influences. ξ v (t), ξ a (t) are random numbers drawn from a given distribution of white noise, i.e., they have zero mean and no temporal correlations. The strengths of the stochastic components are quantified by A vi and A ai , which can also vary across agents.

The deterministic influences on the emotional state of the agent are described by the functions \(\mathcal{F}_{v}\), \(\mathcal{F}_{a}\). They depend on specific assumptions applicable to online collective emotions, in particular the agents’ interaction, access to information, or their response to the media. These functions should also reflect possible dependencies on the emotional state of the agent itself, as emotional states could be more affected by certain emotions and less by other emotions. In the following sections, we extend the description of the agent by defining the actions an agent can take, to then follow in specifying the forms of these functions.

2.3 Emotional Communication in Online Communities

If information with emotional content becomes available to the agent, there should be excited emotional states, which are not externally observable unless the agent decides to communicate, creating a message or posting a comment in a discussion. Consequently, our assumption for the expression of emotions is that the agent expresses its valence through the externally observable variable s i (t) if its arousal exceeds certain individual threshold, \(\mathcal{T}_{i}\)

$$\displaystyle{ s_{i}(t) = r(v_{i}(t))\,\varTheta [a_{i}(t) -\mathcal{T}_{i}] }$$
(10.3)

where Θ[x] is the Heaviside’s function which is one only if x ≥ 0 and zero otherwise. If Θ[x] = 1, we assume that the agent is not able to perfectly communicate its valence state, i.e. the exact value of v i (t), and its expression is simplified through a function r(v). Thus, it is essential to specify this function depending on a coarse-grained representation of the valence of individual agents, which can be adjusted to the accuracy of the data analysis techniques available. In the following, we assume that empirical data only allows us to know the polarity of a message, choosing \(r(v) =\mathop{ \mathrm{sign}}\nolimits (v)\). Additionally, the agent might not be able to immediately express its emotions if the arousal hits the threshold at a particular time t. This expression might be delayed with certain delay Δ t, as the agent might not have immediate access to communication media.

After describing the dynamics of emotional states and emotional expression, we need to specify how this emotional expression is communicated to the other agents. In line with previous models of social interaction (Schweitzer and Hołyst 2000), we assume that every positive and negative expression is stored in a communication field h ±(t) with a component for positive communication h +(t), and another component for negative information h (t). This variable essentially stores the “amount” of available comments of a certain emotional content at a given moment in time. We propose the following equation for the dynamics of the field:

$$\displaystyle{ \frac{d\,h_{\pm }} {dt} = -\gamma _{\pm }h_{\pm }(t) + cn_{\pm }(t) + I_{\pm }(t) }$$
(10.4)

where each agent contribution s i (t) increases the corresponding field component by a fixed amount c at the exact time the expression occurred. This parameter c represents the impact of the information created by the agent to the information field, defining a time scale.

The variable n ±(t) shows the total number of agents contributing positive or negative emotional expression at time t. These expressions are in general time dependent, i.e. they lose importance as they become older, usually due to the creation of new information in the community. This is represented by the exponential decay present in the first term of the right-hand side of Eq. (10.4), which is parametrized through γ ±. In addition, externally produced positive or negative emotional content might change the communication field, as for example news can have a great impact in the overall emotional state of an online community. We model this mechanism through the agent-independent term I ±(t), which can be modeled as a stochastic input, or used to analyze the reactions of the model to external stimuli.

To finish the description of our framework, we need to specify how the available information influences the state of the individual agents, which is covered by the functions \(\mathcal{F}_{v}\) and \(\mathcal{F}_{a}\) of Eq. (10.2).

2.4 Feedback of Communication into Emotional States

The target of our model is to reproduce the emergence of a collective emotion, assuming that it cannot be understood as a simple superposition of individual emotional states. Our assumption is that the emotional expression of an agent may change the emotional state of a number of other agents, either directly or indirectly. For this influence we can define its form and investigate the various possible scenarios through computer simulations and mathematical analysis. Additionally, these can also be empirically tested when individual users are exposed to different emotional content, as discussed in Gianotti et al. (2008) and explored in ongoing experiments (Kappas 2011) like the ones described in Chap. 5.

In the communication field of our model, there are two components for positive, h +(t), and negative, h (t), emotional information. Depending on the state of an agent, it might be affected by these different kinds of information in different ways. A general assumption for this function is that the valence increases with the respective information perceived by the agent. The strength of this influence should depend on the emotional state of the agent, often in a nonlinear manner. A general formulation for this kind of dynamics has the form:

$$\displaystyle{ \mathcal{F}_{v}(h_{\pm }(t),v_{i}(t)) = h_{\pm }(t)\sum _{k=0}^{n}b_{ k}v^{k}(t) }$$
(10.5)

where the key assumption is that the coefficients b k are constants that does not depend on the value of the valence.

Arousal measures the degree in which the emotion encourages or discourages activity. It becomes important when it reaches a threshold \(\mathcal{T}_{i}\), which is assumed to be the precondition for emotional expression (Rimé et al. 1998; Rimé 2009). Emotional expression should have some impact on the arousal, and we assume that the arousal is lowered after producing a message, or set back to the ground state in the most simple case. This means that the dynamics of arousal should be divided into two parts: one applying before the arousal reaches the threshold, and one at the exact moment when it is reached. Hence, we define the dynamics of the arousal a i (t) as:

$$\displaystyle{ \frac{d\,a_{i}} {dt} = \frac{d\,\bar{a}_{i}} {dt} \,\varTheta [\mathcal{T}_{i} - a_{i}(t)] - a_{i}(t)\,\varTheta [a_{i}(t) -\mathcal{T}_{i}] }$$
(10.6)

As long as \(x = \mathcal{T}_{i} - a_{i}(t)> 1\), Θ[x] = 1 and the arousal dynamics are defined by \(\frac{d\,\bar{a}_{i}} {dt}\) as in Eq. (10.2). Once the threshold is reached, x ≥ 0, Θ[x] = 0 and Θ[−x] = 1, deterministically resetting the arousal back to zero.

To conclude the dynamics of arousal, we must specify the function \(\mathcal{F}_{a}\), which applies when the arousal is below the threshold. The arousal was designed to be an orthogonal variable to valence, measuring the activity level of an emotion. It is reasonable to assume that agents respond to all the emotional content available in the community, i.e. the sum of both field components, in a way that depends on their own arousal in a nonlinear manner, regardless of the valence dimension. Following the same general point of view as for the case of valence, we may propose the following nonlinear dependence:

$$\displaystyle{ \mathcal{F}_{a} \propto [h_{+}(t) + h_{-}(t)]\sum _{k=0}^{n}d_{ k}a^{k}(t) }$$
(10.7)

The above description defines a complete framework to design agent-based models of collective emotions in online communities. Simulation and statistical analysis of the properties of these models can explain the reasons for the emergence of collective emotional states from the online interaction of large amounts of users.

2.5 Simulation of Collective Emotions

Models within this framework have the advantage of being tractable, allowing researchers to find analytical solutions that explain the emergence of collective emotions. We illustrate how a simulation of our model creates collective emotional states of polarized emotions in the right panel of Fig. 10.1, where we show the trajectory of valence for ten agents in a simulation. One can notice a quite synchronized change of the emotions, which is not surprising as the dynamics mainly depends on the value of h, which is the same for all agents and all other parameters are kept constant. More details about the mathematical analysis of this model can be found elsewhere (Schweitzer and Garcia 2010), allowing us to understand under which conditions we can observe such collective emotions. In particular, two important aspects can be highlighted: (1) when collective emotions are unipolar (positive or negative), or bipolar, and (2) when collective emotions are triggered by external influences, and when they are endogenously emerging from user interactions, leading to the appearance and disappearance of collective behavior like the one shown in Fig. 10.1.

3 A Model for Emotions in Product Reviews Communities

3.1 Applying the Framework to Review Emotions

The structure of this model is the same as the one shown in Fig. 10.1, where the emotional state of the agents is composed of valence and arousal, and is influenced by a collective information field. To model emotions in product reviews, we use specific assumptions about this kind of communication, which are explained in detail in Garcia and Schweitzer (2011). In our model, we focus on the discussion at the product level, ignoring relations between products. This means that the communication between agents always refers to the reviewed product. It is a particular property of a product that every user is allowed to review it only once. We introduce this constraint in the arousal dynamics. Specifically, after an agent’s arousal reaches its threshold \(\mathcal{T}_{i}\), the threshold is reset to a value of , preventing the agent from making a second review on the same product. We assume that the initial values of these thresholds are heterogeneous among agents, sampled from a normal distribution with mean μ and standard deviation σ.

For this application, we assume that the arousal dynamics depends on the sum of both components of the field (h + and h ), as formalized in Eq. (10.7). For this case, the polynomial function of Eq. (10.7) goes up to the second degree, modeling a quadratic dependence on the agent’s own arousal. Our simulation results (Schweitzer and Garcia 2010) show that this form of arousal dynamics is able to produce the spontaneous emergence and disappearance of collective emotional states. For the valence dynamics, we assume that the influence of the information field in the agent’s valence \(\mathcal{F}_{v}\) depends on the previous value of the agents valence. This means that previous negative experiences of the product lead to a tendency to pay less attention to the positive expression of other agents. On the other hand, agents with positive experiences will be more influenced by positive emotional information than by negative one. We can formalize this asymmetry of agent perception through an exponential function with a cubic decay, as explained in Garcia and Schweitzer (2011).

Writing reviews is heavily influenced by preferences of the users and their relation to the properties of the product. In our model, user preferences are included as an agent internal variable u i , constant in time. The heterogeneity on these preferences is captured by sampling u i from a uniform distribution in the interval [0, 1]. This way we do not assume any kind of general preference towards a particular value, as preferences simply determine what is subjectively preferred and not what is better or worse. Product properties are represented in the same scale as user preferences, as described by a parameter q ∈ [0, 1].

It is a common assumption in product review communities that a reviewer has previously purchased or experienced the reviewed product. In our model, this experience determines the initial value of the valence, calculated as the difference between the agent’s preference u i and the product property q. If a product is at perfect match with a user’s preference | u i q | = 0, the agent starts with a maximum initial valence (v i (0) = 1). If the product happens to be the complete opposite to the agent’s expectations, the value of the difference between both would be maximum and the agent’s valence v i (0) = −1.

According to our framework, the value of an agent’s expression s i is determined by its valence v i . We assume that agent expressions influence the field more the more emotional they are. As product reviews are fairly long texts compared to other kinds of online communication, sentiment analysis techniques are able to provide values for different degrees of emotionality. A review might contain only factual information and not influence the emotions of a reader, but it could also contain mild or extreme emotional content. Following the scheme of SentiStrength, explained in Chap. 6, the value of an agent’s expression s i ranges from − 5 to 5, according to the value of its valence when creating the review.

3.2 Reproducing Emotions in Reviews Data

Our model for emotions in product reviews aims at reproducing collective properties of emotional expression towards products. Our dataset of reviews from Amazon.com contains more than 1.7 million reviews for more than 16.000 products. Each review has been processed with SentiStrength (Thelwall et al. 2013), a sentiment analysis tool that gives values of positive and negative emotions in a text in a scale from 1 to 5. Statistical analysis of this dataset (Garcia and Schweitzer 2011) showed the existence of two patterns of the reaction of the community to the release of a product. Furthermore, emotional expression regarding products followed distributions of a characteristic shape, which our model should reproduce.

Given a particular set of values for the parameters of our model, the initial value of the communication field determines the type of collective dynamics of a simulation. This way the model is able to reproduce the different scenarios we found in the real data, which correspond to reviews resulting from mass media versus word of mouth influence. The left panel of Fig. 10.2 shows the time series of emotional expression in two simulations of the model. The outer plot shows the case when there is a strong input to the field at the beginning of the simulation. This initial impulse, simulating marketing campaigns, forces the dynamics of the community into a vastly decaying single spike. The inset on the left of Fig. 10.2 shows the alternative case of a slower increase of the activity in the community. The simulated time series shows that, in the absence of initial information, the model can build up endogenous cascades of reviews. This kind of dynamics requires a variance of the threshold distribution large enough to trigger some agents that lead the activity in early stages of the simulation.

Fig. 10.2
figure 2

Left: Amount of reviews for two simulations of the product reviews model. Rate of reviews and emotions for a strong media impulse and when the emotions spread through the community (inset). Right: Comparison between the emotional distribution of the reviews for “Harry Potter” (black) and the simulation results (gray) (Garcia and Schweitzer 2011)

The valence dynamics of this model were designed to reproduce different patterns of positive and negative emotional expression in product reviews. The black histogram in the right panel of Fig. 10.2 shows a typical histogram of emotional expression in our Amazon.com dataset. In general, the distribution of negative emotions is more uniformly distributed than the expression of positive emotions, which usually have a large bias towards the maximum value. Gray bars in Fig. 10.2 show the histogram of emotional expression from our simulations. The similarity between both histograms shows how we are able to reproduce the distribution of emotional expression in product reviews, given certain parameter values.

To conclude, Fig. 10.2 shows that the outcome of our model has macroscopic properties similar to real world data on product reviews. Our model provides a phenomenological explanation based on psychological principles, linking the microscopic interaction between agents with the macroscopic behavior we observed in our Amazon.com dataset. In particular, the different time responses and distributions of emotions expressed in the community have the same qualitative properties in model simulations and real data. Within our framework, further explorations of the relation between model and data are possible. For example, each product can be mapped to a set of parameter values that reproduce the collective properties of the community reaction. This would provide a measure of the impact of product properties and marketing in the psychometric space of the customers.

4 Modeling Real-Time Online Emotional Interaction

Another application of our modeling framework provides insights on the nature of human communication in real-time online discussions, i.e. chatrooms. Online communication like the one in chatrooms received recently much attention from the scientific community (Sienkiewicz et al. 2013; Garas et al. 2012). Relevant questions have been identified, such as the role of influential users (Borge-Holthoefer and Moreno 2012), or the time patterns between user actions (Radicchi 2009). The analysis of the times between message creations is a useful tool to detect communication bursts (Wu et al. 2010), as well as periods of inactivity (Garcia et al. 2013). As a result, many statistical regularities of our communication patterns are revealed, like the power-law nature of the waiting time distribution P(τ), where τ is the elapsed time between two consecutive actions of the same user. Such regularities should be, and are, considered in the design of our model. I.e., instead of being driven by the arousal dynamics the level of activity is sampled from the real inter-activity time distribution P(τ) ∼ τ −1. 54, as reported in Garas et al. (2012). The causal relationships between the elements of this model is summarized in the left panel of Fig. 10.3.

Fig. 10.3
figure 3

Left: Schema of the model for emotional persistence in online chatroom communities. Left: distribution of persistence for simulations of the model, taking similar values as the empirical data from IRC channel (Garas et al. 2012)

Using our framework, the valence dynamics should follow Eq. (10.2) and is composed by a superposition of stochastic and deterministic influences:

$$\displaystyle{ \frac{d\,v_{i}} {dt} = -\gamma _{v}v_{i} + b(h_{+} - h_{-})v + A_{v}\xi _{i} }$$
(10.8)

The exponential decay of the valence is determined by γ v and the influence of the information fields is modeled through b(h +h )v. The parameter b quantifies the valence change per time unit due to the discussion of emotional content. This change depends on the balance between positive, h +, and negative, h , components of the field. This differs from the previous assumption used for the modeling of product review communities, but is more appropriate to capture communication in chatrooms. Chat discussions are usually very fast, real-time interactions that display a limited amount of messages to the users. Unlike in collective discussions where large amounts of messages can be accessed at any time, the emotional information in chatrooms cannot grow up to large value. In this model, the aim is to reproduce plausible chatroom interaction, in which users are just able to read a smaller amount of messages created in a short time.

As mentioned before, agents create messages with time intervals sampled from the empirical inter-event distribution. When posting a message, the variable s i of the agent is set to a value that depends on its valence v i . As chat messages are usually very short, we cannot assume the existence of very rich emotional content like in the case of product reviews, but just some emotional orientation as positive, negative, or neutral messages. We formalize the expression of valence polarity as:

$$\displaystyle{ s_{i} = \left \{\begin{array}{rr} - 1&\quad \text{if}\quad v_{i} <V _{-} \\ + 1&\quad \text{if}\quad v_{i}> V _{+} \\ 0& \quad \text{otherwise} \end{array} \right. }$$
(10.9)

where the thresholds V and V + represent the limit values that determine the emotional content of the agent’s expression. These thresholds do not need to be symmetric around zero, as human expression is systematically positively biased (Garcia et al. 2012). If humans communicate in the presence of social norms that encourage positive expression, thresholds should satisfy | V + | < | V  | .

In this application of our framework, the communication field is formulated exactly as in Eq. (10.4), i.e. it increases by a fixed amount c when an agent expresses its emotions. By analyzing the parameter space of the model, we are able to identify parameter values that reproduce observable patterns of real human communication. In Garas et al. (2012), it was shown that there is emotional persistence in online human communication, which reveals that there are collective emotions shared by the participants of the discussion. This emotional persistence can be reproduced by simulated conversations between agents chatting. The distribution of the emergence of this simulated persistence is shown in the right panel of Fig. 10.3.

The insights provided by agent-based models within our framework are of special use for certain ICT applications. Dialog systems, more commonly known because of the use of chatbots, benefit from this framework, as agent-based models can be formulated as computational entities that can simulate human behavior, and interact with users of a dialog system. Our agent-based approach is used for the next generation of emotionally reactive dialog systems (Rank et al. 2013).

5 Models of Collective Emotions in Social Networks

The general modeling framework is also flexible enough to capture models of collective emotions in online social networks. The first application to online social networks is introduced in Chap. 11, and here we outline the relation of that model with our modeling framework. This model of emotional influence between MySpace users builds on the empirical findings about (1) their interaction network, (2) their temporal activity patterns, (3) the entry rate of new users, and (4) the emotionality of their messages. However, we cannot identify using data analysis how messages influence the activity and the emotional state of other users. Thus, in our model we provide hypotheses about this feedback which are tested against the aggregated outcome.

Different from the previous examples where stochasticity was modeled simply by a additive stochastic force, we assume here that stochasticity results from three sources: (1) sampling from the empirical inter-activity time distribution P(Δ t), (2) sampling from the empirical rate p(t) at which new users enter the network, (3) a spontaneous reset of both valence and arousal to a predefined value \((\tilde{v},\tilde{a})\) with a rate r. The latter captures our uncertainty in determining the external influences on an agent’s state and is treated as a tunable parameter as explained below.

To model how agents are affected by the messages they perceive, we designed three levels of aggregated information in our model: (1) aggregation of messages on the agent’s wall which shall be captured by an information field h i , (2) aggregation of messages perceived on the friends’ walls, captured by an information field \(\overline{h}_{i}\), (3) aggregation of messages on all walls, i.e. a mean-field information h mf that that captures a kind of “atmosphere” of the whole community. Because each of the messages in the empirical data has a valence value and an arousal value, the information field h also has a valence and arousal component h v, h a which results from the respective aggregation. Specifically, different from previous modeling assumptions, we assume here that the agent’s arousal and activity (e.g. in choosing conversation partners) is only affected by the arousal information, whereas the agent’s valence is only affected by the valence information. This way we explore the role of richer emotional communication in an advanced model within the cyberemotions modeling framework (Schweitzer and Garcia 2010), which allows us to compare the results to previous models for different online communities.

The right panel of Fig. 10.4 shows the application of our framework to this model: agents A i can post messages M ij on the wall h j of agent A j , which would in turn influence the valence and arousal of A j . The aggregation of the walls in the neighborhood of A i is represented as the field \(\overline{h}_{i}\), for which the wall h j contributes to increase the arousal of A i . Simulations of this model reproduce certain aspects of cascades of collective emotions, as shown in Chap. 11.

The second model variant refers to agents interacting on a square lattice (Czaplicka and Hołyst 2012). The left panel of Fig. 10.4 illustrates the feedback processes involved with reference to the general modeling framework.

Fig. 10.4
figure 4

Schema of the lattice model (Czaplicka and Hołyst 2012) and of the MySpace network model of Chap. 11 (right)

Agents express their emotions through the externally observable variable s i , determined by the agent’s internal emotional valence e i . This valence is assumed to be a discrete variable e i  ∈ { 1−, 0, +1} which can change to any state with a given probability p s as a representation of a spontaneous emotional arousal. The agent expression influences the field of agents around a neighborhood within ε distance, h Γ ε i , and it takes place at events sampled with constant probability p. In addition, the internal state of the agent can influence the field of its neighbors at distance 1 h Γ1i , and be influenced by the own agent’s field h i . Simulations of this model, explained in Czaplicka and Hołyst (2012), produce fluctuations of collective emotions that emerge from this local dynamics.

6 A Data-Driven Model of Emotions of Virtual Humans

In this section we describe a model to capture the mechanisms of emotional communication in a virtual society. The main purpose of the model is to provide means of integration between the available information provided by machine learning tools, and the avatar system that represents the emotional state of the people in a conversation, to be applied to the system shown in Chap. 13 This model relies on a particular set of parameters and influence functions that can be tested from physiological data and from Internet communication, in experiments like the ones explained in Chap. 5. In addition, future user tests with this model will provide feedback from the participants. This way we will have means of testing the quality of particular assumptions or ranges of the parameters from a believable behavior observed by laymen in a controlled setup.

Fig. 10.5
figure 5

Schema of the individual emotions model for virtual humans. Agents are described by their emotional state (VAD). They communicate through a conversation field h ij±, perceive references to them through a personal field h ii±, and update their state given utterances about themselves and user input h iiv , h iia , h iid . U i is the explicit user input about their emotional state

The agents have an emotional state defined by valence, arousal and dominance (VAD), as shown in Fig. 10.5. These are continuous variables that can take positive and negative values and that are not explicitly bounded, but that will be finite given their dynamics. As explained in Sect. 10.2.2, they will have an internal relaxation factor that does not need to be the same for all of them (γ v ,γ a ,γ d ). We assume that agent expressions are given (chat system), so the process that determines the creation of s i (user expression) is not defined. The expression (an utterance) is composed of:

  1. 1.

    Sentiment (positive, negative, neutral)

  2. 2.

    Valence, arousal and dominance

  3. 3.

    Target person (I, you, them)

There are three types of fields that represent the communication of the system:

  • h ij+ and h ij (conversation fields), that store the emotional communication between the agents A i and A j . This assumes that the system simulated is a one-on-one chat. The utterances will create a constant increase in this fields depending on their sentiment sign.

  • h iiv , h iia , and h iid that are the self-influence fields for the refinement of the representation of the emotions of the user. The values of valence, arousal and dominance of the utterances will create a change in these fields that will influence directly the state of the agent towards those values. This change will be stronger when the utterance created has the target I than another one. These fields receive an additional, overriding input from the user that shifts the state of the agent towards what the user decided. This input will come from explicit assessments of valence, arousal and dominance from a visual interface available in some experiments.

  • h i+ and h i are the identity fields of the agent A i . This fields represent the history of the emotional information targeted to this agent, in the sense that the information stored in this fields is specially relevant for the individual A i . The changes in this fields are created by utterances with the class You detected from the target detector.

The valence is generally affected by the conversation fields with a shift parameter that reweights them to give more importance to one than another given the sign of the valence. The second change comes from the self-influence fields, forcing the attractors to particular values stated by the user or inferred from the expression.

$$\displaystyle{ \mathcal{F}_{v} = (\alpha h_{ij+} + (1-\alpha )h_{ij-})(b_{1}v - b_{3}v^{3}) +\beta _{ v}(h_{iiv} - v) }$$
(10.10)

When v > 0 and switching h ij+ and h ij when v < 0. In this function, the balance between the attention towards content of the same or different valence is parametrized through α. b 1 models the direct influence that the field has on the valence, and b 3 is a saturation parameter that ensures that the valence cannot go to infinity. β v is the strength factor of the update to known values of the state from utterances or user input.

The arousal is supposed to increase with information in general, regardless of its valence but depending on how relevant is this information for the individual. This way, the arousal will be increase with all the fields and decrease only based in internal assessments of low arousal, coming from the user input or the arousal of the expression.

$$\displaystyle{ \mathcal{F}_{a} = ((1-\eta )h_{ij} +\eta h_{i})(d_{2}a^{2} - d_{ 3}a^{3}) +\beta _{ a}(h_{iia} - a) }$$
(10.11)

In this arousal dynamics, η balances how stronger is the identity field compared to the conversation field. d 2 and d 3 work in a similar way that the valence counterparts. The quadratic term makes sure that the influence of that term is always positive. Similarly, β a refines the knowledge of the arousal like in the valence.

Our first approximation to the dynamics of the dominance can be based on the identity fields, and how the information directed to the individual changes its power regarding emotions.

$$\displaystyle{ F_{d} = g_{+}h_{i+} - g_{-}h_{i-} +\beta _{d}(h_{iid} - d) }$$
(10.12)

This way, the influence on the dominance would be independent of its own value and just induced by the social identity of the agent. The decay term γ d will ensure that the dominance does not go to infinite values. The parameters g + and g represent the asymmetric effect on the dominance, if the fear reaction is supposed to be fast, it should satisfy g  > g +.

In this model there are two types of fields, signed fields like the conversation field, and VAD field that store a particular point in the emotion space rather than an amount of information. Signed fields have two components: a positive one (h +) and a negative one (h ). The input to these fields is multiplexed to the positive or the negative part given the polarity of the message relevant to them.

$$\displaystyle{ \frac{d\,h_{\pm }} {dt} = -\gamma _{h}h_{\pm } + sM_{\pm }(t) }$$
(10.13)

As for previously defined fields, γ h is the decay factor and s measures the impact that a user has on the field with each message. M ±(t) is the amount of messages directed to the field component in a particular moment. Each message creates an increase only once, as an impulse of size s in the field.

In the model implementation, there are two size of changes s for the two different signed fields: s d if the impact is produced by the utterance of one of the participants, and s t when the utterance is directed to a particular individual. This way, we can adjust the balance between the quality of the information received from targeted utterances versus the aggregated amount of information in the general conversation.

A VAD field is different to a signed field in the sense that it stored values of valence, arousal and dominance rather than generalized positive or negative emotional information. The dynamics of this type of fields are different as they have bounded values and the input has a different nature. It has the same eigendynamics:

$$\displaystyle{ \frac{d\,h_{v}} {dt} = -\gamma _{v}h_{v} }$$
(10.14)

An input to the field changes instantly its value to

$$\displaystyle{ h_{v} = (1 - s_{v})h_{v} + s_{v}S_{v}(t) }$$
(10.15)

where S v (t) is the valence of the utterance that changes the field at time t, and s v is the importance of this utterance, according to its origin, differing between texts and explicit user inputs.

This way, the changes in the VAD field associated to an agent will be sharp, but the changes in the internal variables of the agent, which are the ones to be used to calculate the facial expression, will evolve smoothly but at different speeds. The equations apply the same way to arousal and dominance. In the model, there are three kinds of influence to the self-influence field, according to their origin they will cause different changes: (1) influence due to generalized expression, s s , which correspond to the inherent individual emotions expressed in any text, (2) influence due to self-reference expression (“I” from target detector) s i , coming from utterances classified as first person, and (3) influence due to user input s u , triggered when the users make an assessment about their emotional state. This should be the most important one and close to one.

This model defines a data-driven system which, if run during the interaction of two or more people, provides the time evolution of their emotions in the three dimensions of valence, arousal, and dominance. Thanks to this, virtual human platforms can display rich facial expressions that cover a large variety of states, and these states evolve smoothly in time according to two principles: sentiment analysis from the utterances of a user, and emotion reactions according to the dynamics explained above.

7 Discussion

The applications of our modeling framework are not limited to the ones presented here. For example, a recent article (Mitrović and Tadić 2012) proposes an agent-based model based on our framework, to model emotional interaction in blog sites. The collective behavior of this model was empirically tested versus data from blogs and Digg.com. Additionally, our model has been used to define an agent-based model for emotional behavior in social networking sites, as presented in Chap. 11.

The insights provided by agent-based models within our framework are of special use for certain ICT applications. Dialog systems, more commonly known because of the use of chatbots, benefit from this framework, as agent-based models can be formulated as computational entities that can simulate human behavior, and interact with users of a dialog system. This connection between our agent-based approach and its applications for affective computing are explained in Rank (2010). Furthermore, data-driven simulations of our model have already been implemented in virtual human platforms, in which three-dimensional avatars show facial emotional expression (Ahn et al. 2012). Those platforms run simulations of individual agents to estimate the emotional state of the user, visualizing its emotions through the facial expression of the avatar.

To summarize, our modeling framework provides the means to understand and predict the emergence of collective emotional states, based on the interaction between individual agents. Its analytical tractability allows to find conditions when these states appear and disappear, leading us to the formulation of testable hypothesis of emotion dynamics. We tested some of these hypotheses against datasets of online origin, providing support to the existence of asymmetries in emotional expression. Instances of our models have been proven successful in reproducing collective behavior in product review communities and chatrooms. Future applications aim at applying our framework to other types of online communication, such as forum discussions, and open source communities.