Activity Recognition Through Complex Event Processing: First Findings

Preview:

Citation preview

Activity Recognition Through ComplexEvent Processing: First Findings

Sylvain Hallé, Sébastien Gabouryand Bruno Bouchard

Université du Québec à Chicoutimi, Canada

February 12th, 2016

IMPOSTOR WARNING

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

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

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

. . .

. . .

Time

Power

Peak

Plateau

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

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)

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?

Alan Perlis(1922-1990)

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

,,

OI I . . .

BREAKFAST

Signal processing

Finite-state machines

?

CEP

omplex

vent

rocessing

A declarative event streamquery engine

Booleans

B

Numbers

R

234

π

Strings

S

abc

Functions

X Y→

Sets

X2

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

. . . . . .

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

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.

abc. . . a . . .n cΨ

abc. . . b . . .n c

EVERY nTH OF (T)

TRIM n FROM (T)

WHERE2 1 5 0 2 0

C

C2 1 5 0

(T) WHERE condition

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

++

+

a . . .b

a . . .b

FILE "filename"

SAVE (T) TO "filename"

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... ... ...

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;}}}

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;

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).

*

10*

100

>

10*

100

>

0

10*

100

>

0

0

>

0

10

10*

10

100 10

WL1

700

200

200

I

*

*

O

700

*200

*

OI I

It works

1500 Hz performance

Rapid prototyping -400 LOC3

What vs. how

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

Recommended