<!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>Augmenting Model-Driven Software Engineering for the Internet of Things with Machine Learning</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Armin Moin</string-name>
          <email>moin@in.tum.de</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stephan Rössler</string-name>
          <email>stephan.roessler@softwareag.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stephan Günnemann</string-name>
          <email>guennemann@in.tum.de</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Software AG</institution>
          ,
          <addr-line>Munich</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Technical University of Munich</institution>
          ,
          <addr-line>Munich</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2018</year>
      </pub-date>
      <abstract>
        <p>In this paper, we present the current position of the research project ML-Quadrat, which aims to extend the methodology, modeling language and tool support of ThingML - an open source modeling tool for IoT/CPS - to address Machine Learning needs for the IoT applications. Currently, ThingML ofers a modeling language and tool support for modeling the components of the system, their communication interfaces as well as their behaviors. The latter is done through state machines. However, we argue that in many cases IoT/CPS services involve system components and physical processes, whose behaviors are not well understood in order to be modeled using state machines. Hence, quite often a data-driven approach that enables inference based on the observed data, e.g., using Machine Learning is preferred. To this aim, ML-Quadrat integrates the necessary Machine Learning concepts into ThingML both on the modeling level (syntax and semantics of the modeling language) and on the code generators level. We plan to support two target platforms for code generation regarding Stream Processing and Complex Event Processing, namely Apache SAMOA and Apama.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        The Internet of Things and the Role of Artificial Intelligence.
Currently, we are on the edge of the next industrial revolution, where
the Internet of Things (IoT) and smart Cyber-Physical Systems
(CPS) that are connected via the IoT, provide the infrastructure for
that. The IoT is an expansion of the Internet into new domains,
where constrained embedded devices such as sensors and actuators
play an important role [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Moreover, CPS are systems of systems,
which have both physical and virtual, i.e., digital elements. Artificial
Intelligence (AI) is the key factor that distinguishes between the
previous revolution in the industry world-wide, which led to
industrial automation, and the current one leading to Cognitive Systems
that can possess cognitive capabilities such as ‘learning’.
      </p>
      <p>
        Why Model-Driven Engineering for IoT/CPS?. As mentioned above,
smart Cyber-Physical Systems (CPS) are connected through the
IoT. As these systems of systems are very large, highly distributed,
very heterogeneous and cross-domain, there is an eminent need for
abstraction and automation to be able to specify, design, develop,
analyze, verify and maintain them in a cost-efective manner. One
of the promising approaches that provides both abstraction and
automation is the Model-Driven Engineering (MDE), also known as
Model-Based Engineering, where models are the core elements in
the entire life-cycle from the specification and design phase to the
implementation, deployment and maintenance phases. 1 MDE has
already proven quite successful in some domains such as Embedded
Systems, e.g., in the automobile industry. Hence, it sounds like the
most natural and the most suitable approach to address the said
challenges in the domain of CPS/IoT. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
      </p>
      <p>
        ThingML: an open source state-of-the-art MDE solution for IoT/CPS.
When we talk about MDE, we actually mean Model-Driven Software
Engineering (MDSE), particularly the Domain-Specific Modeling
(DSM) approach to that. One such state-of-the-art solution for the
CPS/IoT domain, which is available as free open source software, is
ThingML 2. ThingML is not only the name of the project, but also
the name of the domain-specific modeling language, the
methodology and the free open source tool supporting them. The (textual)
model editor of ThingML supports the user (e.g., a CPS/IoT service
developer) to model the distributed system using the following
elements: (i) components (i.e., Things) with asynchronous message
passing interfaces (Ports), (ii) composite state machines aligned with
the UML2 state charts for specifying the behavior of components,
and (iii) an imperative action language for the event processing
rules. This action language is platform-independent, but includes a
template language for linking platform-specific models in an easy
manner. Once the model is complete, code generators (also known
as Model-to-Text or Model-to-Code transformations in the MDSE
terminology) can be employed to automatically generate the full
implementation for specific target platforms and communication
protocols that are supported by ThingML. The generated
implementation includes the source code and configuration scripts, and may
also include documentation. Last but not least, the ThingML tool is
built based on the free open source Eclipse Modeling Framework
(EMF), thus highly extensible and interoperable. [
        <xref ref-type="bibr" rid="ref4 ref5">4, 5</xref>
        ]
      </p>
      <p>Motivation &amp; Contribution of this Position Paper. We argue that
model-driven software engineering languages and tools for the IoT
shall provide support for Machine Learning by design. Concretely,
we propose a complementary view for specifying the behavior of
components, i.e., things in ThingML, which is not based on state
machines in their current form, but based on inference from the
observed data. This means, we enable a data-driven approach for
specifying the behavior. In other words, using this complementary
view, one shall be able to model the Machine Learning algorithm at
design-time and let the system partially or fully learn the behavior
based on the observed data at run-time. In Section 2, we illustrate
our position. This comprises the comparison of models in Machine
1Although the border between these phases might not exist anymore in its classic
sense for modern applications.
2We chose ThingML due to the prior work of our industrial partner.
Learning and models in Software Engineering, our core idea on
integrating them for the IoT applications, the advantages that we
consider, and the challenges that we foresee for that. Finally, we
conclude in Section 3.
2</p>
    </sec>
    <sec id="sec-2">
      <title>OUR POSITION</title>
      <p>We believe that the Model-Driven Engineering (MDE)
methodologies and tools for the Internet of Things (IoT) and smart
CyberPhysical Systems (CPS) must support the Artificial Intelligence (AI)
needs of these applications both on the modeling level and also on
the code generation level in an integrated and seamless manner.
Hence, we propose an alternative view for modeling the behavior of
components, i.e., things in ThingML. This new view enables users
of the tool to delegate the definition of the behavior of the thing (i.e,
system competent or IoT device) to the AI algorithms (specifically
ML algorithms), which are able to conduct inference based on the
observed data. In other words, for complex behaviors that are not
easily understandable and specifiable via state machines, the ML
algorithms can learn the respective behaviors on their own in an
efective and eficient manner. In addition, we provide an extension
to the existing view for specifying behaviors using state machines
so that advanced data analytics algorithms and methods can be
employed for event detection and triggering state transitions. This
latter contribution is inline with the contributions of the research
project HEADS funded by the European Commission (FP7), where
Complex Event Processing (CEP) capabilities have been introduced
to the ThingML tool (also known as the HEADS IDE in the
context of that project), e.g., using the CEP platform Apama. Figure
1 depicts the graphical representation of a state machine that is
currently used (with the existing ThingML tool) for modeling the
behavior of a smart Air Conditioner using the data that comes
through asynchronous message passing from a temperature sensor
in the room.
2.1</p>
    </sec>
    <sec id="sec-3">
      <title>Models in Machine Learning vs. Software</title>
    </sec>
    <sec id="sec-4">
      <title>Engineering</title>
      <p>
        ML Models. Machine Learning (ML) is currently used as a
promising data-driven approach in industry to address many complex
problems. ML is one of the several fields that are widely used in
data analytics. 3 In data-driven approaches, we observe the data
instances generated by some process, then we build some model
3It is perhaps the most important one. For instance, Deep Neural Networks, a family
of ML algorithms are currently widely used in industry.
(e.g., statistical) and train that model via a ML algorithm using the
data instances. Finally, we use the trained model in future, e.g.,
for making predictions about the possible outputs of that process.
Hence, a model in ML is an abstraction / artifact that can help
us in making inference based on the observed data, e.g., for
making predictions. A popular example for this use case is predictive
maintenance, where ML models can predict possible failures of the
system in advance, e.g., based on anomaly detection. There exist
various ways for categorizing ML models and algorithms. For
instance, ML models fall from one point of view into two categories:
parametric and non-parametric. In parametric models, we assume
a specicfi functional form for the model (i.e., the statistical
distribution that is assumed to be the generator of the observed data),
where a small number of parameters control the form of the model.
The linear regression model and the Neural Networks family are
examples of the linear and nonlinear parametric models,
respectively. However, in non-parametric models, the form of the model
is defined by the size of the dataset. Although these models still
contain parameters, their parameters do not afect the form of the
model, but its complexity. One popular example of this category is
the Support Vector Machines (SVM) family. Unlike parametric
models, non-parametric ones usually keep part of the data instances or
all of them for their future use. For this reason, they are also called
memory-based or instance-based. Confusingly, some sources refer
to the non-memory-based models as model-based. However, we do
not use that term. In our view, all mentioned approaches for ML
modeling are model-based. Last but not least, some diagrammatic
representation of probability distributions used in ML, known as
Probabilistic Graphical Models (PGM) has provided a very intuitive,
sound and useful way of visualization and analysis of ML models.
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
      </p>
      <p>SE Models. From the above explanation, it is clear that ML
models are very much diferent than SE models. Popular examples of SE
models can be found in the UML (Unified Modeling Language)
standard. They can usually be categorized into structural models and
behavioral models (including interactions). The models in ThingML
are currently merely SE models. However, we plan to link them
with ML models. In the following, we explain our position in more
detail.
2.2</p>
    </sec>
    <sec id="sec-5">
      <title>Bringing ML Models and SE models</title>
    </sec>
    <sec id="sec-6">
      <title>Together</title>
      <p>
        It is NOT (only) about Model-based Machine Learning. In his
scientific article, Model-based Machine Learning [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], Christopher M.
Bishop has already called for following a model-driven approach in
the field of ML similar to the Model-Driven Software Engineering
(MDSE) paradigm. Specifically, he has proposed the concept of
probabilistic programming and presented a Domain-Specific Modeling
Language (DSML) called Infer.NET for PGMs [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>It is NOT (only) about abstraction nor (merely) code generation.
There exist already various workflow designers and frameworks
in the field of data analytics such as KNIME, RapidMiner, CamSaS
Musketeer and TensorBoard that make conducting data analytics
tasks more eficient. They provide a higher level of abstraction and
support various target data analytics and data engineering
platforms for partial or full code generation. Similarly, in the field of
IoT, there exist several mashup tools that provide a higher level
of abstraction for developing IoT services by combining data and
services over the IoT. Note that many of these cloud-based tools
go far beyond simple mashup and also ofer other cloud services
such as data analytics and AI capabilities. Examples include but are
not limited to the startup waylay.io, Microsoft Azure and the IBM
Watson IoT Platform. However, we propose a holistic approach
that provides a methodology and tool support for systematic
engineering of the entire software / smart services for the IoT/CPS
applications. This includes also the data analytics (specifically ML)
and IoT mashup capabilities. Our approach is based on the MDE
paradigm. Note that this systematic approach is not the case in
any of the said solutions. For instance, using the existing tools, one
cannot separate the business logic and the underlying technologies
and at the same time cover both the Data Science and
Engineering as well as the Software Engineering aspects of the IoT/CPS
applications.</p>
      <p>It is NOT (necessarily) about Graphical / Visual Diagrams. Note
that when we talk about DSML and modeling in general, we do
not necessarily mean graphical / visual diagrams. Model instances
and model editors can be also textual. It is often a
misunderstanding that modeling has necessarily something to do with graphical
representations. However, we plan to make our DSML and
modeling tool graphical / visual, in order to make it more intuitive and
user-friendly.</p>
      <p>
        Advantages. Beside the typical advantages of MDE, and the
specific advantages of the MDE for the domain of IoT/CPS, which by
nature involves much more heterogeneity and much larger scale
than classic application domains such as embedded systems (see,
e.g., [
        <xref ref-type="bibr" rid="ref4 ref5">4, 5</xref>
        ]), we can ofer the advantage of facilitating the
employment of data analytics algorithms and methods on the modeling
level and having the source code still automatically generated out
of the model instances. This way, software engineers, who do not
necessarily have deep knowledge and skills in the filed of Data
Science and Engineering can easily create smart services for the
IoT/CPS without mastering the algorithms (e.g., ML algorithms) and
data analytics methods as well as the various underlying platforms
(e.g., Spark, Storm, Flink, Samza). This will make an important
contribution to the current problem of lack of Data Scientists in the
industry world-wide. Note that the tool will provide some hints
and advice during the modeling time to support the user of the
tool in employing the ML algorithms and data analytics methods.
Concretely, we plan to support the Apache SAMOA as well as the
Apama platforms for code generation. However, our tool will be
open source and fully extensible for further platforms and use cases.
      </p>
      <p>Challenges. Again, similar to the advantages, we do not mention
the typical challenges of MDE and MDE for the IoT, but rather
the specific ones for this work. Currently, we foresee the main
challenge to be related to the very diferent natures of models in
SE and ML. For instance, it sounds quite challenging to generate
code out of the model instances that do not have state machines
for behavior specification, but rather inference models. Moreover,
ML models and algorithms themselves are also quite diferent and
require very diferent measures, e.g, for data preparation. Further,
often one cannot simply use the ML algorithms and methods just as
black-boxes. Actually, one can do that, but there will be usually no
good results. For instance, Neural Networks that are quite popular,
are very sensitive to the initialization of their parameters and also to
the architectural decisions including but not limited to the number
of hidden layers, number of units per layer, and so forth. Since we
do not yet have any formal specification for such practices, but
instead they are conducted based on experiments by practitioners,
it will be quite challenging to abstract such problems and tasks
from the user and go for full automation. This also holds for data
preparation and cleansing tasks. Such challenges are studied and
addressed in a relatively new field of ML, known as AutoML.</p>
    </sec>
    <sec id="sec-7">
      <title>3 CONCLUSIONS</title>
      <p>In this paper, we presented the current position of the research
project ML-Quadrat on the topic of MDE4IoT. We proposed
supporting AI, particularly, Machine Learning, in modeling tools by
design on the modeling level and on the code generators level. We
believe that a holistic approach and a systematic methodology that
covers both the SE and the ML aspects is needed. The project
MLQuadrat aims to realize this vision using the ThingML tool as the
basis.</p>
    </sec>
    <sec id="sec-8">
      <title>ACKNOWLEDGMENTS</title>
      <p>This work is funded by the German Federal Ministry of Research
and Education (BMBF) through the Software Campus initiative
(project ML-Quadrat).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Luigi</given-names>
            <surname>Atzori</surname>
          </string-name>
          , Antonio Iera, and
          <string-name>
            <given-names>Giacomo</given-names>
            <surname>Morabito</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>The Internet of Things: A Survey</article-title>
          .
          <source>Comput. Netw</source>
          .
          <volume>54</volume>
          ,
          <issue>15</issue>
          (Oct.
          <year>2010</year>
          ),
          <fpage>2787</fpage>
          -
          <lpage>2805</lpage>
          . https://doi.org/10.1016/j. comnet.
          <year>2010</year>
          .
          <volume>05</volume>
          .010
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Christopher</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Bishop</surname>
          </string-name>
          .
          <year>2006</year>
          .
          <article-title>Pattern Recognition and Machine Learning</article-title>
          . Springer.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Christopher</surname>
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Bishop</surname>
          </string-name>
          .
          <year>2013</year>
          .
          <article-title>Model-based Machine Learning</article-title>
          .
          <source>Philosophical Transactions of the Royal Society of London A: Mathematical, Physical and Engineering Sciences</source>
          <volume>371</volume>
          ,
          <year>1984</year>
          (
          <year>2013</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Frank</given-names>
            <surname>Fleurey</surname>
          </string-name>
          and
          <string-name>
            <given-names>Brice</given-names>
            <surname>Morin</surname>
          </string-name>
          .
          <year>2017</year>
          .
          <article-title>ThingML: A Generative Approach to Engineer Heterogeneous and Distributed Systems</article-title>
          .
          <source>In 2017 IEEE International Conference on Software Architecture Workshops (ICSAW).</source>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Nicolas</given-names>
            <surname>Harrand</surname>
          </string-name>
          , Franck Fleurey, Brice Morin, and Knut Eilif Husa.
          <year>2016</year>
          .
          <article-title>ThingML: A Language and Code Generation Framework for Heterogeneous Targets</article-title>
          .
          <source>In Proceedings of the ACM/IEEE 19th International Conference on Model Driven Engineering Languages and Systems (MODELS '16).</source>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Bernhard</given-names>
            <surname>Schaetz</surname>
          </string-name>
          .
          <year>2014</year>
          .
          <article-title>The Role of Models in Engineering of Cyber-Physical Systems - Challenges and Possibilities</article-title>
          .
          <source>In CPS20.</source>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>