<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Toward Synthesis of Event-Pattern Detectors for Event Complex Processing with Using Machine Learning</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Grygoriy Zholtkevych</string-name>
          <email>g.zholtkevych@karazin.ua</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stanislav Lukyanenko</string-name>
          <email>stlukyanenko@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Natalya Polyakovska</string-name>
          <email>natalipolyakovska@gmail.com</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Informatics, Technical University of Munich 3</institution>
          ,
          <addr-line>Boltzmannstr., 85748, Garching</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Math and Comp. Sci. School, V.N. Karazin Kharkiv National University 4</institution>
          ,
          <addr-line>Svobody Sqr., Kharkiv, 61022</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The tendency to expand the use of event-driven architecture leads to the need to improve the e ciency of designing components of such systems, in particular, event-pattern detectors. Authors of the paper propose to use machine-learning to automate designing processes of event-pattern detectors. For substantiating their opinion, the authors conducted a series of computer experiments, showing that the idea is not groundless. Summing up, the authors draw attention to the issues that require further research aimed at creating information technology for the synthesis of event-pattern detectors.</p>
      </abstract>
      <kwd-group>
        <kwd>event-driven-architecture</kwd>
        <kwd>self-delimiting Turing machine</kwd>
        <kwd>event stream processing</kwd>
        <kwd>event-pattern detector</kwd>
        <kwd>machine learning algorithm</kwd>
        <kwd>computer experiment</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Global network solutions, based on the Internet platform, which include
besides software components various subsystems of information
registration and executive physical subsystems form the class of complex systems
developing successfully nowadays. This class of systems is called
Internetof-Things (IoT) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. It can be considered as the subclass of the more wide
class of systems so-called cyber-physical systems (CPS) [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. From an
architectural point of view, systems of this class are distributed systems whose
integrity is maintained through the interaction of system components by
messaging. This architectural approach is known as Message-Driven
Architecture, wich is more known as Event-Driven Architecture (EDA) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        Realisation of EDA for information systems is known as Event Stream
Processing (ESP). ESP is a complex of technological tools designed for
assisting the development of event-driven information systems [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. One of
the most important units of ESP systems is the event-pattern detector.
The main purpose of the detector associated with a system component is
the accumulation of a sequence of messages about events that are relevant
to this component, and at the moment when the accumulated
information becomes su cient to make a decision about the class of the current
situation, it transmits the corresponding message to the executive system.
      </p>
      <p>
        The mathematical model of such a system is proposed in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], and the
\black box" models associated with such systems is studied in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>
        In this paper, we propose to discuss the possibility of using machine
learning methods for automating synthesis process of one simple but
important class of event-pattern detectors. We use some ideas contained in
[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Mathematical Model of Detectors</title>
      <p>To build a mathematical model of an event-pattern detector, we need to
establish how the detector interacts with other components of the ESP
system or, in other words, what is the system context of the detector.
This context is presented in Fig. 1. This sequence diagram is the same as
the diagram in [10, Fig. 2, p. 105] excepting some insigni cant changes.
We use this sequence diagram as a framework for building a mathematical
model of event-pattern detectors used in ESP systems.</p>
      <p>We accept the following series of suggestions, which is the base for
building a mathematical model of the detector.</p>
      <p>Suggestion 1. Each message is characterised by its class that is uniquely
determined and belongs the nite prede ned set of event classes. A
message can contain additional information but this information is used by
executive systems only.</p>
      <p>Suggestion 2. There are a nite set of event-patterns and each
eventpattern is a language over event classes.</p>
      <p>Suggestion 3. Any in nite sequence of messages contains at most one
message that a detector accepts and, therefore, classi es.</p>
      <p>Suggestion 4. A detector halts immediately if it has made a decision
about belonging to some class of the received word otherwise it continues
waits for an additional information to continue the analysis.
These suggestions lead us to the following mathematical model, which we
call a pattern-detecting machine.</p>
      <p>start()
msg
par
loop
put(msg)
loop</p>
      <p>get()
msgs
opt [decision 6=</p>
      <p>UNKNOW]
reset()
set(INITIAL)</p>
      <p>:Detector
analise(msgs)</p>
      <p>decision
job for processing
set(decision)
:Detector
b
De nition 1. Let and be nite sets called the event class set and
the pattern set respectively then an event detector is a computable pre
xfree partial mapping from + into .</p>
      <p>In this de nition the following notation and concepts are used:
+ refers to the set of all nite non-empty sequences (non-empty words)
of elements belonging to ;
a pre x-free partial mapping means that this mapping is de ned on a
subset of words that cannot contain a proper pre x of a word if it contains
the word;
a computable mapping means that for the mapping, there exists a Turing
machine that halts on a word if and only if this word belongs to the
domain of the mapping and the mapping value on the word coincides
with output of the Turing machine.</p>
      <p>The above suggestions cause to the conclusion that a self-delimiting
Turing machine is adequate and the most general mathematical model of
an event-pattern detector. We give the corresponding de nition following
[8, see Sections 4.3 and 4.4] with minor changes.</p>
      <p>De nition 2. An event-pattern detector with the class set and the
pattern set where and are nite sets is a Turing machine with
two tapes, one of which is called the input tape, i.e. it is right-way in nite
and its head can move only to the right, and another is called the working
tape, i.e. it is two-way in nite and the behaviour of its head is not limited.
In addition, is an alphabet of the input type and it is assumed that each
its cell has lled before the start of detector operation.</p>
      <p>Finally, elements of are uniquely associated with nal states of the
machine. Thus, the machine makes a decision at the moment of its halting
and this decision is the element of associated with the corresponding
nal state.</p>
      <p>Bearing in mind that a general self-delimiting Turing machine is an overly
complex object, we con ne ourselves to some simple subclass of these
machines, namely, the subclass of those machines that do not have a
working tape.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Regular Event-Pattern Detectors</title>
      <p>In the case where a self-delimiting Turing machine does not have the
working tape, it can be described similarly to a nite state machine.
De nition 3. A regular event-pattern detector is determined by a
quintuple D = ( ; ; Q; q0; ) where
{ is a nite alphabet of message classes;
{ is a nite alphabet of decisions;
{ Q is a nite set of machine states;
{ q0 2 Q is some selected state, called the initial state;
{ : Q ! Q S is a mapping called the transition function.
Now we de ne the relation ` + that models deriving the decision
for the given input in the following manner
for a1 : : : an 2 + and 2
such that
qk = (qk 1; ak) for all 0 &lt; k &lt; n , and
, there exists q1; : : : ; qn 1 2 Q
= (qn 1; an) .</p>
      <p>(1)
Using mathematical induction gives the following statement.
Proposition 1. If u `
uniquely , i.e. if u `</p>
      <p>for u 2 + and
and u ` 0 for ; 0 2
2</p>
      <p>then u determines
then 0 = .</p>
      <p>Now we can formulate the idea how to use machine learning for the
synthesis of regular event-pattern detectors.</p>
      <p>Let us assume that for the system being designed, an expert community
has found some nite set T = f(uk; k) 2 + j k = 1; : : : N g such
that the subset fuk j k = 1; : : : N g + is pre x-free, in other words,
for any 0 &lt; k 6= l N , neither uk is a pre x of ul nor ul is a pre x of uk .
Then we need to nd a regular event-pattern detector such that ensures
uk ` k for all (uk; k) 2 T and k = 1; : : : ; N under condition that the
number of states of the detector is minimal.
4</p>
      <p>Regular Detector Synthesis Algorithm
For the synthesis of a regular event-pattern detector according to the
aforementioned idea, we use a two-step method. The rst step provides
to build a tree-like detector DT and the second step provides to improve
this detector reducing it while this is possible. The reduced completely
detector D is considered as the required.</p>
      <p>The algorithm of the rst step is presented in Alg. 1. A simple analysis
of this algorithm shows that detector DT ensures u ` for some u 2 +
and 2 if and only if (u; ) 2 T .</p>
      <p>The algorithm of the second step is presented in Alg 2. A simple
analysis of the presented algorithm shows
1. for any (u; ) 2 T , the deriving u ` is preserved for the detector</p>
      <p>D ;
2. each step of the algorithm loop does not increase the number of states
of the detector.
5</p>
    </sec>
    <sec id="sec-4">
      <title>Estimation of Algorithm E ciency</title>
      <p>To evaluate the algorithm, we use an experimental environment, that
randomly generates a detector D accordingly to Def. 3 based on xed
alphabet , set of decisions and a number of possible states M . In
these experiments we use common set of possible decisions and a common
alphabet. We assign a random 2 to every possible terminal.</p>
      <p>We use such a detector D to generate stochastically paths, ending in
terminal nodes. Such paths represents the behaviour of word recognition,
Data: An alphabets and and set T
Result: The tree-like detector DT
q0 ;
Q fq0g;
T = fu 2 + j (u; ) 2 T for some
for u 2 T do</p>
      <p>Q Q Sfu0 2
+ j u0 is any proper pre x of ug
end
Q Q Sftrashg;
for u 2 Q , a 2 do
if ua 2 Q then</p>
      <p>def (u; a) = ua
else if (ua; ) 2 T then</p>
      <p>def (u; a) =
end
for a 2 do</p>
      <p>def (trash; a) = trash
end
return ( ; ; Q; q0; );
else
end
def (u; a) = trash</p>
      <p>Algorithm 1: Building a tree-like detector
T = f(uk; k) 2
Alg. 1.
thus for every possible detector D we are able to generate a set of pairs
+ j 1 &lt; k N g of recognised words T as in</p>
      <p>For every generated detector D from the corresponding DT using the
aforementioned algorithm, we generate a model detector D .</p>
      <p>The accuracy of the synthesis is estimated as the probability to make
the same decision by both detectors D and D .</p>
      <p>
        Data: A tree-like detector DT
Result: The synthesised detector D
D = DT ;
for q 2 Q , a 2 do
if (q; a) = trash then
x is the result of random choice from Q S ;
redef (q; a) = x;
minimise the modi ed detector D using Hopcroft's algorithms [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
end
end
return D
      </p>
      <p>Algorithm 2: Reduction algorithm
After which, we check model's accuracy based on a D. One can see in
Fig. 2 that the accuracy of the implemented algorithm for a detector with
the two-element set of decisions under certain circumstances can reach up
to 0:891 .</p>
      <p>In the Fig. 3, the dependence of accuracy of synthesis on the number
of states of the current detector in the learning process.
Summing up, we can state that the idea of using machine learning
algorithms in the design of event detectors is not unreasonable. Nevertheless,
this document raises a number of problems that need to be solved in
the process of creating information technology for the synthesis of
eventpattern detectors on the base machine learning algorithms.</p>
      <p>Such problems include
Problem 1. Is it true that D = Pr
detector D ?
lim DT for any regular event-pattern</p>
      <p>T !D
For the special case, when contains only two elements this statement
transforms into the following statement.</p>
      <p>Problem 2. Is it true that L = Pr
for any regular language L ?
lim T where T is nite and T
T !L</p>
      <p>L
Problem 3. Is it possible to improve the convergence of the algorithm by
considering not only the set of con rmatory samples but also the set of
counterexamples?</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>1. Overview of the Internet of Things</article-title>
          . Recomendation
          <string-name>
            <surname>ITU-T Y</surname>
          </string-name>
          .4000/Y.2060, International Telecommunication Union (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Chandy</surname>
            ,
            <given-names>K.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Charpentier</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Capponi</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Towards a theory of events</article-title>
          .
          <source>In: Proceedings of the 2007 Inaugural International Conference on Distributed Eventbased Systems</source>
          . pp.
          <volume>180</volume>
          {
          <fpage>187</fpage>
          . DEBS '07,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Dorozhynsky</surname>
          </string-name>
          , V.:
          <article-title>Regular complex event processing machine</article-title>
          .
          <source>Information Processing Systems</source>
          <volume>133</volume>
          (
          <issue>8</issue>
          ),
          <volume>82</volume>
          {
          <fpage>86</fpage>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Dorozhynsky</surname>
          </string-name>
          , V.:
          <article-title>Mathematical models for speci cation and analysis of the eventdriven system components</article-title>
          .
          <source>PhD Thesis</source>
          , School of Mathematics and Computer Science at V.N. Karazin Karkiv National University, 4,
          <string-name>
            <surname>Svobody</surname>
            <given-names>sqr.</given-names>
          </string-name>
          ,
          <source>Kharkiv</source>
          ,
          <volume>61022</volume>
          ,
          <string-name>
            <surname>Ukraine</surname>
          </string-name>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Etzion</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Niblett</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          : Event Processing in Action. Manning Publications Co.,
          <string-name>
            <surname>Greenwich</surname>
            ,
            <given-names>CT</given-names>
          </string-name>
          , USA (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Hopcroft</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>An n log n algorithm for minimizing states in a nite automaton</article-title>
          .
          <source>In: Theory of machines and computations</source>
          . pp.
          <volume>189</volume>
          {
          <fpage>196</fpage>
          . Academic Press, New York (
          <year>1971</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Khaitan</surname>
            ,
            <given-names>S.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>McCalley</surname>
            ,
            <given-names>J.D.</given-names>
          </string-name>
          :
          <article-title>Design techniques and applications of cyber physical systems: A survey</article-title>
          .
          <source>IEEE Systems Journal</source>
          <volume>9</volume>
          (
          <issue>2</issue>
          ),
          <volume>350</volume>
          {
          <fpage>365</fpage>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Shen</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Uspensky</surname>
            ,
            <given-names>V.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vereshchagin</surname>
          </string-name>
          , N.:
          <article-title>Kolmogorov Complexity and Algorithmic Randomness</article-title>
          ,
          <source>Mathematical Surveys and Monographs</source>
          , vol.
          <volume>220</volume>
          . American Mathematical Society (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Zholtkevych</surname>
          </string-name>
          , G.:
          <article-title>Realisation of synchronous and asynchronous black boxes using machines</article-title>
          . In: V.
          <string-name>
            <surname>Yakovyna</surname>
            , et al. (eds.) ICT in Education, Research, and
            <given-names>Industrial</given-names>
          </string-name>
          <string-name>
            <surname>Applications</surname>
          </string-name>
          . CCIS, vol.
          <volume>594</volume>
          , pp.
          <volume>124</volume>
          {
          <fpage>139</fpage>
          . Springer Iternational Publishing,
          <string-name>
            <surname>Switzerland</surname>
          </string-name>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Zholtkevych</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Novikov</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dorozhynsky</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Pre-automata and complex event processing</article-title>
          . In: V.
          <string-name>
            <surname>Ermolayev</surname>
          </string-name>
          , et al. (eds.) ICT in Education, Research, and Industrial Applications. pp.
          <volume>100</volume>
          {
          <fpage>116</fpage>
          . CCIS, Springer Cham, Heidelberg New York Dordrecht London (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>