• No results found

Inter-EPN Parallelization of Consecutive Events:

8.4 Use case analysis

8.5.1 Inter-EPN Parallelization of Consecutive Events:

The first use case evaluation is based on the consecutive events as in §8.4.1, the events emerging from the accelerometers carried by individuals are examined for identifica- tion of activities over a period of time. Events are distributed to multiple computing nodes. The single stream of events or tuples continually arriving to be processed, for simplicity, is ordered in the temporal sequence based on the arrival time. To introduce inter-EPN parallelization, an example is given which monitors the acceleration with respect to X, Y and Z co-ordinates through a sensor. The sensors are embedded in- side the utensils in the kitchen and the events are streamed. The sensors periodically notify the measurements and a few rules are listed to highlight the problem in the inter-EPN parallelization. Consider the following definitions:

1. Three event types X, Y and Z are generated from the accelerometer.

2. Each event type is streamed at a frequency of 100 events per second. A rolling window of 64 events needs to be created. At the occurrence of every 32 event, the preceding 32 events need to be grouped.

3. Events need to be temporally ordered.

The rule for the use case illustrated in Figure 8.13 is defined as :

Compute statistics on every s consecutive events of type X, Y and Z, where s=64. On the occurrence of every s=32 event, preceding consecutive events are grouped.

Figure 8.13: Illustration of event distribution

For example, the system starts with event arrival from one person and scaled to 100 persons sending 100 events per second approximately. This leads to the replication of the EPNs, distribution of the incoming events every few seconds or based on the par- ticular tuple counts and aggregation of the outcome. The methodology of partitioning the incoming events is described during the use case evaluation, in Figure 8.2. The aggregation of events for the stated use case can be performed using pre-determined aggregation functions. This is an example of a complex query where the distribution of the events and aggregation of results involve transfer or the maintenance of the events/state among the EPNs.

In this application, the events are timestamped (within the event processing engine) and ordered in the EPN according to the timestamps. Processing events from the source creates the derived events in the subsequent stages. The new derived events are defined by (i) the attributes and type (ii) specific sequence of events whose occurrence has lead to the complex event, and (iii) defining the new value for the event. The event processing rule for the use case in Figure8.13 is defined as :

Compute activity recognition on the events emerging from the accelerometer grouped by a device and the source of origin.

The steps utilised to evaluate the use case are listed below:

1. Detect 32 consecutive events from three different data sources X, Y and Z . The occurrence of the thirty two consecutive events in a stated sequence is used to generate a window.

2. When 32 type X events are detected in any of the computing nodes, it broadcasts a message to all other computing nodes to search for the preceeding 32 events satisfying the temporal order. Implement the algorithm illustrated in §8.4.1). In this case, the parameter s is defined to be 32. There might be few cases where part of 32 events fall in the head or tail of the partition. The algorithm in §8.4.1) states the appropriate rules to address it.

3. Once a pattern seek is initiated, EPNs distributed in multiple computing nodes respond when the match is found. The waiting time to seek a match can be decided based on the probability for the event to happen at nth attempt.

4. The pattern matching occurs whenever 32 consecutive events of type X, Y and Z are detected, which may occur in any of the EPNs placed in the distributed computing node.

Incoming data can be split from one computing node succeeding to another computing node as illustrated in Figure 8.2. For example consider a cluster of four nodes where the row keys are numbers in the range of 0 and 100. Each node is responsible for processing the events under the wrapping range. This restricts only a subset of the computing nodes to search for the occurrence of the consecutive events. All the events are restricted to check the nodes bound to a subset of the range. The number of initiated search conditions is likely to reduce under efficient partitioning.

In this use case, features in the activity recognition are computed based on the event streams using the continuous queries as illustrated in 8.14. Each continuous query embedded inside the EPN processes the events emerging from the accelerometers, placed throughout the ambient kitchen. The simplest method of evaluation is based on the event occurrence in the time domain measures. Events at any point in time or intervals between successive normal-to-normal intervals (NN) are used for the compu- tation of statistics. Inferences on statistical variation from the precomputed pattern of activity recognition are used on a series of computed events, particularly events measured over a bound count of event window or longer bounds based on the oc- currence of the primitive events (acceleration X, Y and Z in this example), which determines the activity recognition. Event selection in a stated rule is grouped based on individuals or device identifier, which bind the value of instantaneous events or complex statistical time domain computation.

s e l e c t avg ( x ) as meanX , avg ( y ) as meanY , avg ( z ) as meanZ , avg ( M a t h . a t a n 2 ( y , M a t h . s q r t ( x * x + z * z ))) as M e a n P i t c h , avg ( M a t h . a t a n 2 ( x , M a t h . s q r t ( y * y + z * z ))) as M e a n R o l l , s t d d e v ( x ) as stdDevX , s t d d e v ( y ) as stdDevY , s t d d e v ( z ) as stdDevZ , s t d d e v ( M a t h . a t a n 2 ( y , M a t h . s q r t ( x * x + z * z ))) as S t d d e v P i t c h , s t d d e v ( M a t h . a t a n 2 ( x , M a t h . s q r t ( y * y + z * z ))) as S t d d e v R o l l , avg ( x * x ) as EnergyX , avg ( y * y ) as EnergyY ,

avg ( z * z ) as EnergyZ ,

avg ( M a t h . a t a n 2 ( y , M a t h . s q r t ( x * x + z * z )) * M a t h . a t a n 2 ( y , M a t h . s q r t ( x * x + z * z ))) as E n e r g y P i t c h ,

avg ( M a t h . a t a n 2 ( x , M a t h . s q r t ( y * y + z * z )) * M a t h . a t a n 2 ( x , M a t h . s q r t ( y * y + z * z ))) as E n e r g y R o l l ,

min ( c u r t ) as l1_min , max ( c u r t ) as l 1 _ m a x f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 )

g r o u p by d e v i c e i d o u t p u t e v e r y 32 e v e n t s s e l e c t ( c o u n t ( * ) * sum ( x * y ) - sum ( x )* sum ( y ))/

(( M a t h . s q r t ( c o u n t ( * ) * sum ( x * x ) - sum ( x )* sum ( x )))

* ( M a t h . s q r t ( c o u n t ( * ) * sum ( y * y ) - sum ( y )* sum ( y ) ) ) ) as corX , ( c o u n t ( * ) * sum ( y * z ) - sum ( z )* sum ( y ))/

(( M a t h . s q r t ( c o u n t ( * ) * sum ( z * z ) - sum ( z )* sum ( z ))) * ( M a t h . s q r t ( c o u n t ( * ) * sum ( y * y ) - sum ( y )* sum ( y ) ) ) ) as c o r Y ( c o u n t ( * ) * sum ( x * z ) - sum ( z )* sum ( x ))/

(( M a t h . s q r t ( c o u n t ( * ) * sum ( z * z ) - sum ( z )* sum ( z ))) * ( M a t h . s q r t ( c o u n t ( * ) * sum ( x * x ) - sum ( x )* sum ( x ) ) ) ) f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 ) g r o u p by d e v i c e i d o u t p u t e v e r y 32 e v e n t s s e l e c t ((( c o u n t ( * ) / 6 4 ) * M a t h . log ( c o u n t ( * ) / 6 4 ) ) * c o u n t ( * ) ) as E n t r o p y P i t c h f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 ) g r o u p by pitch , d e v i c e i d o u t p u t e v e r y 32 e v e n t s s e l e c t ((( c o u n t ( * ) / 6 4 ) * M a t h . log ( c o u n t ( * ) / 6 4 ) ) * c o u n t ( * ) ) as E n t r o p y R o l l , d e v i c e i d f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 ) g r o u p by roll , d e v i c e i d o u t p u t e v e r y 32 e v e n t s s e l e c t ((( c o u n t ( * ) / 6 4 ) * M a t h . log ( c o u n t ( * ) / 6 4 ) ) * c o u n t ( * ) ) as E n t r o p y X f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 ) g r o u p by x , d e v i c e i d o u t p u t e v e r y 32 e v e n t s s e l e c t ((( c o u n t ( * ) / 6 4 ) * M a t h . log ( c o u n t ( * ) / 6 4 ) ) * c o u n t ( * ) ) as E n t r o p y Y f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 ) g r o u p by y , d e v i c e i d o u t p u t e v e r y 32 e v e n t s s e l e c t ((( c o u n t ( * ) / 6 4 ) * M a t h . log ( c o u n t ( * ) / 6 4 ) ) * c o u n t ( * ) ) as E n t r o p y Z f r o m M e r g e d S t r e a m . win : l e n g t h ( 6 4 ) g r o u p by z , d e v i c e i d o u t p u t e v e r y 32 e v e n t s