46
Activity Recognition Through Complex Event Processing: First Findings Sylvain Hallé, Sébastien Gaboury and Bruno Bouchard Université du Québec à Chicoutimi, Canada February 12th, 2016

Activity Recognition Through Complex Event Processing: First Findings

Embed Size (px)

Citation preview

Page 1: Activity Recognition Through Complex Event Processing: First Findings

Activity Recognition Through ComplexEvent Processing: First Findings

Sylvain Hallé, Sébastien Gabouryand Bruno Bouchard

Université du Québec à Chicoutimi, Canada

February 12th, 2016

Page 2: Activity Recognition Through Complex Event Processing: First Findings

IMPOSTOR WARNING

Page 3: Activity Recognition Through Complex Event Processing: First Findings
Page 4: Activity Recognition Through Complex Event Processing: First Findings

1. ...2. ...3. ...

Page 5: Activity Recognition Through Complex Event Processing: First Findings

1. ...2. ...3. ...X

Page 6: Activity Recognition Through Complex Event Processing: First Findings

1. ...2. ...3. ...X

Page 7: Activity Recognition Through Complex Event Processing: First Findings
Page 8: Activity Recognition Through Complex Event Processing: First Findings
Page 9: Activity Recognition Through Complex Event Processing: First Findings
Page 10: Activity Recognition Through Complex Event Processing: First Findings
Page 11: Activity Recognition Through Complex Event Processing: First Findings

. . .

Page 12: Activity Recognition Through Complex Event Processing: First Findings

. . .

Page 13: Activity Recognition Through Complex Event Processing: First Findings

Time

Power

Peak

Plateau

Page 14: Activity Recognition Through Complex Event Processing: First Findings

0

200

400

600

800

1000

1200

8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754

S.WL2S.WL1

T.x

Example: Blender

Page 15: Activity Recognition Through Complex Event Processing: First Findings

SS-PL3>-393| FFT-L2-6<=-3| | SS-PL2<=1071: ToasterON| | SS-PL2>1071: ElectricKettleON| FFT-L2-6>-3| | FFT-L2-6<=9| | | SS-PL1 <=148| | | | SS-QL1<=-169: RangeHoodFanOFF| | | | SS-QL1>-169| | | | | SS-QL1<=135| | | | | | SS-PL1<=-788: CoffeeMakerOff| | | | | | | | | | | | SS-PL1>-788| | | | | | | FFT-L1-1<=-788:| | | | | | | CoffeeMakerOFF| | | | | | | FFT-L1-1>-408| | | | | | | | FFT-L1-5 <=153:MixerOff| | | | | | | | FFT-L1-5->153...

(Maitre et al. 2013)

Page 16: Activity Recognition Through Complex Event Processing: First Findings

SS-PL3>-393| FFT-L2-6<=-3| | SS-PL2<=1071: ToasterON| | SS-PL2>1071: ElectricKettleON| FFT-L2-6>-3| | FFT-L2-6<=9| | | SS-PL1 <=148| | | | SS-QL1<=-169: RangeHoodFanOFF| | | | SS-QL1>-169| | | | | SS-QL1<=135| | | | | | SS-PL1<=-788: CoffeeMakerOff| | | | | | | | | | | | SS-PL1>-788| | | | | | | FFT-L1-1<=-788:| | | | | | | CoffeeMakerOFF| | | | | | | FFT-L1-1>-408| | | | | | | | FFT-L1-5 <=153:MixerOff| | | | | | | | FFT-L1-5->153...

(Maitre et al. 2013)

How do you isolate a single device?How do you add a new device?How do you adjust noise thresholds?How do you reuse that output?

Page 17: Activity Recognition Through Complex Event Processing: First Findings

Alan Perlis(1922-1990)

Beware of of the Turing tar-pit in which everything is possible but nothing of interest is easy. ,,

,,

Page 18: Activity Recognition Through Complex Event Processing: First Findings

OI I . . .

BREAKFAST

Signal processing

Finite-state machines

?

Page 19: Activity Recognition Through Complex Event Processing: First Findings

CEP

omplex

vent

rocessing

Page 20: Activity Recognition Through Complex Event Processing: First Findings

A declarative event streamquery engine

Page 21: Activity Recognition Through Complex Event Processing: First Findings

Booleans

B

Numbers

R

234

π

Strings

S

abc

Functions

X Y→

Sets

X2

Page 22: Activity Recognition Through Complex Event Processing: First Findings

A processor is a function that takes 0 or moreevent traces as input, and returns 0 or 1event trace as output

. . . . . .

Page 23: Activity Recognition Through Complex Event Processing: First Findings

Processors can be composed: the output ofa processor can be given as the input ofanother ("piping")

Page 24: Activity Recognition Through Complex Event Processing: First Findings

BeepBeep is an event stream query engine that provides...

A set of basic processors (independent fromany event type)

A core grammar and interpreter tocompose ("pipe") processors

Mechanisms to extend the grammarwith user-defined events, processors, etc.

Page 25: Activity Recognition Through Complex Event Processing: First Findings

abc. . . a . . .n cΨ

abc. . . b . . .n c

EVERY nTH OF (T)

TRIM n FROM (T)

Page 26: Activity Recognition Through Complex Event Processing: First Findings

WHERE2 1 5 0 2 0

C

C2 1 5 0

(T) WHERE condition

Page 27: Activity Recognition Through Complex Event Processing: First Findings

COMBINE (T) WITH f

Σ+2 1 5 0 2 3 8

f

f

8

2 1 5 0 2 1 5 0

f1 5 0 1 5 0

f5 0 5 0

++

+

Page 28: Activity Recognition Through Complex Event Processing: First Findings

a . . .b

a . . .b

FILE "filename"

SAVE (T) TO "filename"

Page 29: Activity Recognition Through Complex Event Processing: First Findings

On every fifth trading day starting today,calculate the average closing price of MSFT for the five most recent trading days, and keepthe query standing for fifty trading days.

timestamp stockSymbol closingPrice

0 APPL 1039.30 MSFT 950.00 GOGL 433.31 MSFT 951.21 APPL 1038.3... ... ...

Page 30: Activity Recognition Through Complex Event Processing: First Findings

On every fifth trading day starting today,calculate the average closing price of MSFT for the five most recent trading days, and keepthe query standing for fifty trading days.

String line = br.readLine().trim();if (!line.isEmpty()) { String[] parts = line.split(","); if (parts[0].compareTo("ABC") != 0) { value_index++; sum += Double.parseDouble(parts[1]); if (value_index == 5) { double average = sum / 5; value_index = 0; sum = 0; return average;}}}

Page 31: Activity Recognition Through Complex Event Processing: First Findings

On every fifth trading day starting today,calculate the average closing price of MSFT for the five most recent trading days, and keepthe query standing for fifty trading days.

SELECT afd FROM ( SELECT S1.timestamp AS ts, AVG(S2.closingPrice) AS afd FROM (SELECT * FROM stocks WHERE stockSymbol = "MSFT") AS S1, (SELECT * FROM stocks WHERE stockSymbol = "MSFT") AS S2 WHERE (S2.timestamp - S1.timestamp) < 5 GROUP BY S1.timestamp) AS S3WHERE MOD(ts, 5) = 0;

Page 32: Activity Recognition Through Complex Event Processing: First Findings

On every fifth trading day starting today,calculate the average closing price of MSFT for the five most recent trading days, and keepthe query standing for fifty trading days.

EVERY 5TH OF ( APPLY (THE AVERAGE OF (*)) TO ( SELECT closingPrice FROM stocks) WHERE (stockSymbol) = ("MSFT")))) ON A WINDOW OF 5).

Page 33: Activity Recognition Through Complex Event Processing: First Findings
Page 34: Activity Recognition Through Complex Event Processing: First Findings

*

Page 35: Activity Recognition Through Complex Event Processing: First Findings

10*

Page 36: Activity Recognition Through Complex Event Processing: First Findings

100

>

10*

Page 37: Activity Recognition Through Complex Event Processing: First Findings

100

>

0

10*

Page 38: Activity Recognition Through Complex Event Processing: First Findings

100

>

0

0

>

0

10

10*

Page 39: Activity Recognition Through Complex Event Processing: First Findings

10

100 10

WL1

Page 40: Activity Recognition Through Complex Event Processing: First Findings

700

200

200

I

*

*

O

700

*200

*

Page 41: Activity Recognition Through Complex Event Processing: First Findings

OI I

Page 42: Activity Recognition Through Complex Event Processing: First Findings
Page 43: Activity Recognition Through Complex Event Processing: First Findings
Page 44: Activity Recognition Through Complex Event Processing: First Findings
Page 45: Activity Recognition Through Complex Event Processing: First Findings
Page 46: Activity Recognition Through Complex Event Processing: First Findings

It works

1500 Hz performance

Rapid prototyping -400 LOC3

What vs. how

https://liflab.github.io/beepbeep-3