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 / 29 V. Lampos bill@lampos.net Detecting Events and Patterns in the Social Web 1/29 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/29

1/29

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/29

2/29

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/29

3/29

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/29

4/29

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/29

5/29

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/29

6/29

slide-7
SLIDE 7

Nowcasting Events from the Social Web

  • V. Lampos

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

7/29

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/29

8/29

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/29

9/29

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/29

10/29

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/29

11/29

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/29

12/29

slide-13
SLIDE 13

Flu rates – Example of selected features

Figure 4: 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 13/29

13/29

slide-14
SLIDE 14

Rainfall 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 14/29

14/29

slide-15
SLIDE 15

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 6: 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 15/29

15/29

slide-16
SLIDE 16

Flu Detector

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

Figure 7: 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 16/29

16/29

slide-17
SLIDE 17

Extracting Mood Patterns from the Social Web

  • V. Lampos

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

17/29

slide-18
SLIDE 18

Computing a mood score

Table 1: 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 18/29

18/29

slide-19
SLIDE 19

Circadian mood patterns (1/2)

Figure 8: 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 19/29

19/29

slide-20
SLIDE 20

Circadian mood patterns (2/2)

Figure 9: 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 20/29

20/29

slide-21
SLIDE 21

The mood of the nation (1/4)

Figure 10: 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, 2012)

  • V. Lampos

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

21/29

slide-22
SLIDE 22

The mood of the nation (2/4)

Figure 11: 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, 2012)

  • V. Lampos

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

22/29

slide-23
SLIDE 23

The mood of the nation (3/4)

Figure 12: 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 23/29

23/29

slide-24
SLIDE 24

The mood of the nation (4/4)

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

Figure 13: 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 24/29

24/29

slide-25
SLIDE 25

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 14: Further information extraction examples from Twitter content

(Lampos, 2012a & 2012b)

  • V. Lampos

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

25/29

slide-26
SLIDE 26

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 26/29

26/29

slide-27
SLIDE 27

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 27/29

27/29

slide-28
SLIDE 28

Last Slide!

The end. Any questions?

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

  • V. Lampos

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

28/29

slide-29
SLIDE 29

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. M.F. Porter. An algorithm for suffix stripping. Program 14(3), pp. 130–137, 1980.
  • 6. V. Lampos and N. Cristianini. Tracking the flu pandemic by monitoring the Social
  • Web. Proceedings of CIP ’10, pp. 411–416, 2010.
  • 7. V. Lampos, T. De Bie and N. Cristianini. Flu Detector – Tracking Epidemics on
  • Twitter. Proceedings of ECML PKDD ’10, pp. 599–602, 2010.
  • 8. T. Lansdall-Welfare, V. Lampos and N. Cristianini. Nowcasting the mood of the
  • nation. Significance 9(4), pp. 26–28, 2012.
  • 9. 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)

  • 10. 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 29/29

29/29