Detecting Events and Patterns in the Social Web with Statistical - - PowerPoint PPT Presentation

detecting events and patterns in the social web with
SMART_READER_LITE
LIVE PREVIEW

Detecting Events and Patterns in the Social Web with Statistical - - PowerPoint PPT Presentation

Detecting Events and Patterns in the Social Web with Statistical Learning Vasileios Lampos Computer Science Department University of Sheffield 1 / 34 V. Lampos bill@lampos.net Detecting Events and Patterns in the Social Web 1/34 Outline


slide-1
SLIDE 1

Detecting Events and Patterns in the Social Web with Statistical Learning

Vasileios Lampos

Computer Science Department University of Sheffield

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 1/34

1/34

slide-2
SLIDE 2

Outline

⊥ Motivation, Aims ⊥ Data ⊣ Nowcasting Events from the Social Web ⊣ Extracting Mood Patterns from the Social Web | = Conclusions

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 2/34

2/34

slide-3
SLIDE 3

Facts

We started to work on this idea in 2008, when...

  • Web contained 1 trillion unique pages (Google)
  • Social Networks were rising, e.g.
  • Facebook: 100m users in 2008, 955m in 2012 (June)
  • Twitter: 6m users in 2008, 500m active users in 2012 (April)
  • User behaviour was changing
  • Socialising via the Web
  • Giving up privacy

(Debatin et al., 2009)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 3/34

3/34

slide-4
SLIDE 4

Questions

  • Does user generated text posted on Social Web platforms include

useful information?

  • How can we extract this useful information...

... automatically? Therefore, not we, but a machine.

  • Practical / real-life applications?
  • Can those large samples of human input assist studies in other

scientific fields? Social Sciences, Psychiatry...

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 4/34

4/34

slide-5
SLIDE 5

One slide on @Twitter. What does a ‘tweet’ look like?

Figure 1: Some biased and anonymised examples of tweets (limit of 140 characters/tweet, # denotes a topic)

(a) (user will remain anonymous) (b) they live around us (c) citizen journalism (d) flu attitude

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 5/34

5/34

slide-6
SLIDE 6

Data Collection

  • Considered to be the easiest part of the process...

... not true!

  • Storage space
  • Crawler implementation, parallel data processing
  • Equipment, new technologies (e.g. Map-Reduce)
  • Data collected and used in the following experiments
  • tweets geo-located in 54 urban centres in the UK
  • collected periodically (every 3 or 5 minutes per urban centre)
  • approx. 0.5 billion tweets by 10 million users (06/2009 to 01/2012)
  • ground truth (regional flu & local rainfall rates)
  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 6/34

6/34

slide-7
SLIDE 7

Nowcasting Events from the Social Web

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 7/34

7/34

slide-8
SLIDE 8

‘Nowcasting’?

We do not predict the future, but infer the present − δ i.e. the very recent past

) (

) (u

M 

) (u

W

) (u

S

State of the World

Figure 2: Nowcasting the magnitude of an event (ε) emerging in the real world from Web information

Our case studies: nowcasting (a) flu rates & (b) rainfall rates (?!)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 8/34

8/34

slide-9
SLIDE 9

What do we get in the end?

5 10 15 20 25 30 2 4 6 8 10 12 14 16

Days Rainfall rate (mm) − Bristol Actual Inferred

Figure 3: Inferred rainfall rates for Bristol, UK (October, 2009)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 9/34

9/34

slide-10
SLIDE 10

Core Methodology (1/3) – Turning text into numbers

Candidate features (n-grams): C = {ci} Set of Twitter posts for a time interval u: P(u) = {pj} Frequency of ci in pj: g(ci, pj) =

  • ϕ

if ci ∈ pj,

  • therwise.

– g Boolean, maximum value for ϕ is 1 – Score of ci in P(u): s

  • ci, P(u)

=

|P(u)|

  • j=1

g(ci, pj) |P(u)|

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 10/34

10/34

slide-11
SLIDE 11

Core Methodology (2/3)

Set of time intervals: U = {uk} ∼ 1 hour, 1 day, ... Time series of candidate features scores: X (U) =

  • x(u1) ... x(u|U|)T ,

where x(ui) =

  • s
  • c1, P(ui)

... s

  • c|C|, P(ui)T

Target variable (event): y(U) =

  • y1 ... y|U|

T

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 11/34

11/34

slide-12
SLIDE 12

Core Methodology (3/3) – Feature selection

Solve the following optimisation problem: min

w

X (U)w − y(U)2

ℓ2

s.t. wℓ1 ≤ t, t = α · wOLSℓ1, α ∈ (0, 1].

  • Least Absolute Shrinkage and Selection Operator (LASSO)

(Tibshirani, 1996)

  • Enforce sparsity on w (feature selection)
  • Least Angle Regression (LARS) – computes entire regularisation

path

(Efron et al., 2004)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 12/34

12/34

slide-13
SLIDE 13

How do we form candidate features?

  • Commonly formed by indexing the entire corpus

(Manning, Raghavan and Schütze, 2008)

  • We extract them from Wikipedia, Google Search results, Public

Authority websites (e.g. NHS) Why?

  • reduce dimensionality to bound the error of LASSO

L(w) ≤ L( ˆ w) + Q, with Q ∼ min W 2

1

N + p N , W 2

1

N + W1 √ N

  • p candidate features, N samples, empirical loss L( ˆ

w) and ˆ wℓ1 ≤ W1

(Bartlett, Mendelson and Neeman, 2011)

  • Harry Potter Effect!
  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 13/34

13/34

slide-14
SLIDE 14

The ‘Harry Potter’ effect (1/2)

Figure 4: Events co-occurring with the inference target may affect feature selection, especially when the sample size is small.

180 200 220 240 260 280 300 320 340 50 100 150 200 250 300

Day Number (2009) Event Score

Flu (England & Wales) Hypothetical Event I Hypothetical Event II

(Lampos, 2012a)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 14/34

14/34

slide-15
SLIDE 15

The ‘Harry Potter’ effect (2/2)

Table 1: Top-20 1-grams correlated with flu rates in England/Wales (06–12/2009)

1-gram Event

  • Corr. Coef.

latitud Latitude Festival 0.9367 flu Flu epidemic 0.9344 swine

  • 0.9212

harri Harry Potter Movie 0.9112 slytherin

  • 0.9094

potter

  • 0.8972

benicassim Benicàssim Festival 0.8966 graduat Graduation (?) 0.8965 dumbledor Harry Potter Movie 0.8870 hogwart

  • 0.8852

quarantin Flu epidemic 0.8822 gryffindor Harry Potter Movie 0.8813 ravenclaw

  • 0.8738

princ

  • 0.8635

swineflu Flu epidemic 0.8633 ginni Harry Potter Movie 0.8620 weaslei

  • 0.8581

hermion

  • 0.8540

draco

  • 0.8533

snape

  • 0.8486

Solution: ground truth with as many peaks/troughs as possible

(Lampos, 2012a)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 15/34

15/34

slide-16
SLIDE 16

About n-grams

1-grams:

  • decent (dense) representation in the Twitter corpus
  • unclear semantic interpretation

Example: “I am not sick. But I don’t feel great either!” 2-grams:

  • very sparse representation in tweets
  • possibly clearer semantic interpretation

Based on our experimental process... a hybrid combination of 1-grams and 2-grams improves inference performance

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 16/34

16/34

slide-17
SLIDE 17

Flu rates – Example of selected features

Figure 5: Font size is proportional to the weight of each feature; flipped n-grams are negatively weighted. All words are stemmed (Porter, 1980).

(Lampos and Cristianini, 2012)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 17/34

17/34

slide-18
SLIDE 18

Rainfall rates – Example of selected features

Figure 6: Font size is proportional to the weight of each feature; flipped n-grams are negatively weighted. All words are stemmed (Porter, 1980).

(Lampos and Cristianini, 2012)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 18/34

18/34

slide-19
SLIDE 19

Examples of inferences

5 10 15 20 25 30 20 40 60 80 100 120

Days Flu Rate − C.England & Wales Actual Inferred

(a) Central England/Wales (flu)

5 10 15 20 25 30 20 40 60 80 100 120

Days Flu Rate − S.England Actual Inferred

(b) South England (flu)

5 10 15 20 25 30 2 4 6 8 10 12 14 16

Days Rainfall rate (mm) − Bristol Actual Inferred

(c) Bristol (rain)

Figure 7: Examples of flu and rainfall rates inferences from Twitter content

(Lampos and Cristianini, 2012)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 19/34

19/34

slide-20
SLIDE 20

Flu Detector

URL: http://geopatterns.enm.bris.ac.uk/epidemics

Figure 8: Flu Detector uses the content of Twitter to nowcast flu rates in several UK regions

(Lampos, De Bie and Cristianini, 2010)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 20/34

20/34

slide-21
SLIDE 21

Extracting Mood Patterns from the Social Web

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 21/34

21/34

slide-22
SLIDE 22

Computing a mood score

Table 2: Mood terms from WordNet Affect

Fear Sadness Joy Anger afraid depressed admire angry fearful discouraged cheerful despise frighten disheartened enjoy enviously horrible dysphoria enthousiastic harassed panic gloomy exciting irritate ... ... ... ... (92 terms) (115 terms) (224 terms) (146 terms)

Mood score computation for a time interval u using n mood terms and a sample of D days: Ms(u) = 1 |D|

|D|

  • j=1
  • 1

n

n

  • i=1

sf(tj,u)

i

  • sf(td,u)

i

= f(td,u)

i

− ¯ fi σfi , i ∈ {1, ..., n}.

f

(td,u) i

: normalised frequency of a mood term i during time interval u in day d∈D

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 22/34

22/34

slide-23
SLIDE 23

Circadian mood patterns (1/2)

Figure 9: Circadian (24-hour) mood patterns based on UK Twitter content

Fear Score

3 6 9 12 15 18 21 24

  • 0.1

0.1 Winter Summer 3 6 9 12 15 18 21 24

  • 0.1

0.1 Aggregated Data

Sadness Score

3 6 9 12 15 18 21 24

  • 0.1

0.1 3 6 9 12 15 18 21 24

  • 0.1

0.1

Joy Score

3 6 9 12 15 18 21 24

  • 0.1

0.1 3 6 9 12 15 18 21 24

  • 0.1

0.1

Hourly Intervals Anger Score

3 6 9 12 15 18 21 24

  • 0.05

0.05

Hourly Intervals

3 6 9 12 15 18 21 24

  • 0.05

0.05

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 23/34

23/34

slide-24
SLIDE 24

Circadian mood patterns (2/2)

Figure 10: Autocorrelation of circadian mood patterns based on hourly lags revealing periodicities

1 12 24 36 48 60 72 84 96 108 120 132 144 156 168 0.2 0.4

  • Autocorr. Lags (Hours)
  • Autocorr. (Fear)

Autocorr.

  • Conf. Bound

(a) Fear

1 12 24 36 48 60 72 84 96 108 120 132 144 156 168 0.1 0.2 0.3 0.4

  • Autocorr. Lags (Hours)
  • Autocorr. (Sadness)

Autocorr.

  • Conf. Bound

(b) Sadness

1 12 24 36 48 60 72 84 96 108 120 132 144 156 168 −0.2 0.2 0.4

  • Autocorr. Lags (Hours)
  • Autocorr. (Joy)

Autocorr.

  • Conf. Bound

(c) Joy

1 12 24 36 48 60 72 84 96 108 120 132 144 156 168 0.1 0.2 0.3

  • Autocorr. Lags (Hours)
  • Autocorr. (Anger)

Autocorr.

  • Conf. Bound

(d) Anger

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 24/34

24/34

slide-25
SLIDE 25

The mood of the nation (1/5)

Figure 11: Daily time series for the mood of Joy based on Twitter content geo-located in the UK , e d by st is.

  • d

ied d ying location s,

Jul 09 Jan 10 Jul 10 Jan 11 Jul 11 Jan 12 −2 2 4 6 8 10 933 Day Time Series for Joy in Twitter Content Date Normalised Emotional Valence

* RIOTS * CUTS * XMAS * XMAS * XMAS * roy.wed. * halloween * halloween * halloween * valentine * valentine * easter * easter

raw joy signal 14−day smoothed joy

(Lansdall, Lampos and Cristianini, 2012a&b)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 25/34

25/34

slide-26
SLIDE 26

The mood of the nation (2/5)

Figure 12: Daily time series for the mood of Anger based on Twitter content geo-located in the UK

Jul 09 Jan 10 Jul 10 Jan 11 Jul 11 Jan 12 −4 −3 −2 −1 1 2 3 4 5 933 Day Time Series for Anger in Twitter Content Date Normalised Emotional Valence

* RIOTS * CUTS * XMAS * XMAS * XMAS * roy.wed. * halloween * halloween * halloween * valentine * valentine * easter * easter

raw anger signal 14−day smoothed anger

(Lansdall, Lampos and Cristianini, 2012a&b)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 26/34

26/34

slide-27
SLIDE 27

The mood of the nation (3/5)

Figure 13: Change point detection using a 100-day moving window

Jul 09 Jan 10 Jul 10 Jan 11 Jul 11 Jan 12 −1 −0.5 0.5 1 1.5 Date Difference in mean Anger Fear Date of Budget Cuts Date of Riots

(Lansdall, Lampos and Cristianini, 2012a)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 27/34

27/34

slide-28
SLIDE 28

The mood of the nation (4/5)

Figure 14: Projections of 4-dimensional mood signals on their top-2 principal

components (based on 2011 Twitter content)

−1.5 −1 −0.5 0.5 1 −0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 Saturday Sunday Monday Tuesday Wednesday Thursday Friday 1st Principal Component 2nd Principal Component Days of the Week

(a) Days of the week (2011)

−8 −6 −4 −2 2 4 6 8 −2 2 4 6 8 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 5253 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 8687 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 1st Principal Component 2nd Principal Component Days in 2011

(b) Days of the year (2011) Days 1/45/358/365: New Year’s / Valentine’s / Christmas Eve / New Year’s Eve Days 122/204/221: O.B. Laden’s death / Winehouse’s death, Breivik / UK riots (Lampos, 2012a)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 28/34

28/34

slide-29
SLIDE 29

The mood of the nation (5/5)

URL: http://geopatterns.enm.bris.ac.uk/mood

Figure 15: Mood of the Nation uses the content of Twitter to nowcast mood rates in several UK regions

(Lampos, 2012a)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 29/34

29/34

slide-30
SLIDE 30

More applications (snapshots)

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 59 60 61 62 63 64 65 66 67 68 20 25 30 35 40 45 50 55 Polls Voting Intention Percent CON Inferred LAB Inferred LIBDEM Inferred CON Poll LAB Poll LIBDEM Poll

(a) Inferences of voting intention polls prior to the UK 2010 General Election (b) Content similarity network

Figure 16: Further information extraction examples from Twitter content

(Lampos, 2012a & 2012b)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 30/34

30/34

slide-31
SLIDE 31

Not covered

Amongst the things you didn’t see:

  • how the model inconsistency problems of LASSO are resolved
  • different schemes for combining 1-grams and 2-grams
  • performance metrics and comparison with baseline techniques or
  • ther nonlinear, nonparametric learners
  • further statistical analysis and psychiatric viewpoint of

circadian mood patterns

  • comparison of different scoring functions for mood signals
  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 31/34

31/34

slide-32
SLIDE 32

Conclusions

  • Social Web holds valuable information
  • interesting inferences can be made by applying statistical

methods on Twitter (user-generated) content

  • machines can extract portions of this information automatically
  • nowcasting events (flu and rainfall case studies)
  • extraction of collective mood patterns

Currently participating in the TrendMiner EU-FP7 project. How user-generated web content can be used to... ⊸ model political opinion ⊸ infer voting intention polls, election/referendum outcome ⊸ nowcast/predict financial indicators

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 32/34

32/34

slide-33
SLIDE 33

Last Slide!

The end. Any questions?

Download the slides from http://goo.gl/F1G7a

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 33/34

33/34

slide-34
SLIDE 34

References

1.

  • B. Debatin, J.P. Lovejoy, A.M.A. Horn, B.N. Hughes. Facebook and Online Privacy: Attitudes, Behaviors, and

Unintended Consequences. Journal of Computer-Mediated Communication 15, pp. 83–108, 2009. 2.

  • V. Lampos and N. Cristianini. Nowcasting Events from the Social Web with Statistical Learning. ACM TIST

3(4), n. 72, 2012. 3.

  • R. Tibshirani. Regression Shrinkage and Selection via the LASSO. Journal of the Royal Statistical Society, series

B, 58(1), pp. 267–288, 1996. 4.

  • B. Efron, T. Hastie, I. Johnstone and R. Tibshirani. Least Angle Regression. The Annals of Statistics 32(2), pp.

407–499, 2004. 5. C.D. Manning, P. Raghavan and H. Schütze. Introduction to Information Retrieval. Cambridge University Press,

  • p. 544, 2008.

6. P.L. Bartlett, S. Mendelson and J. Neeman. L1-regularized linear regression: persistence and oracle inequalities. Probability Theory and Related Fields, pp. 1–32, 2011. 7. M.F. Porter. An algorithm for suffix stripping. Program 14(3), pp. 130–137, 1980. 8.

  • V. Lampos and N. Cristianini. Tracking the flu pandemic by monitoring the Social Web. Proceedings of CIP ’10,
  • pp. 411–416, 2010.

9.

  • V. Lampos, T. De Bie and N. Cristianini. Flu Detector – Tracking Epidemics on Twitter. Proceedings of ECML

PKDD ’10, pp. 599–602, 2010. 10.

  • T. Lansdall-Welfare, V. Lampos and N. Cristianini. Effects of the Recession on Public Mood in the UK.

Proceedings of WWW ’12, pp. 1221–1226, 2012.(a) 11.

  • T. Lansdall-Welfare, V. Lampos and N. Cristianini. Nowcasting the mood of the nation. Significance 9(4), pp.

26–28, 2012.(b) 12.

  • V. Lampos. Detecting Events and Patterns in Large-Scale User Generated Textual Streams with Statistical

Learning Methods. PhD Thesis, University of Bristol, p. 243, 2012.(a) 13.

  • V. Lampos. On voting intentions inference from Twitter content: a case study on UK 2010 General Election.

CoRR, 2012.(b)

  • V. Lampos

bill@lampos.net Detecting Events and Patterns in the Social Web 34/34

34/34