1 Introduction

Internet-of-Things (IoT) has already started to shape into reality from its hype and promises to incredibly impact every aspect of human life. IoT is expected to drive the future Internet by connecting and automating everyday objects from human body to kitchen and garden appliances, to plants, etc.; thus, it brings the notion of SmartLiving. This has been possible due to the swift advancements in IoT-enabling technologies. More and more such everyday objects are being connected daily and hundreds of billions of things are expected to be connected in the foreseeable future. Research until now mostly focused on architecture and communication aspects of IoT. It is certain that the trend of connecting any possible thing will continue to upsurge; at the same time, IoT necessitates to bring its focus to other aspects such as making sense of data [1]. Making sense of data implies alleviating intelligence of things by reaping value from the data [2]. As an implication of things increase, data generated in IoT becomes massive which has mostly been ignored with respect to analysis, utilisation and providing intelligence [1,2,3]. It is estimated that about 5% of data is ever analysed [3], while the number could be as low as less than 1% [1]. One of the primary reasons for the low percentage of data utilisation or analysis is that the collected data is raw and does not provide any usefulness [2, 4] which can be mitigated by providing meaning to the raw data, i.e., by contextualisation [2].

Reaping value from data corresponds to enabling instantaneous and informed decision-making. We are moving from a connected world vision to an automated world vision enabled by IoT. Such vision can only be realised by providing intelligence to the connected world. Intelligence, that is, application of knowledge, has so far mostly been limited to cloud-based solutions [2, 5]. In the fast forwarding IoT paradigm, depending only on the cloud-based solutions bring, among other issues, latency and centralised issues [2, 5, 6]. Edge computing is expected to mitigate few of the issues raised by over reliance on the cloud [6, 7]. However, cloud computing cannot be ignored altogether since edge computing as of now is expected to provide solutions based on small dataset, and cloud computing can take care of the bigger datasets. One solution to cater this is to employ a distributed approach such as distributed intelligence-assisted solution [2, 6]. Distributed intelligence-assisted solution implies that application of knowledge is distributed to cloud and edge. An automated, informed and instantaneous IoT application necessitates applying knowledge with low latency and proximity along with the mobility support as envisioned by next-generation 5G IoT vision [3]. Earlier mobile devices such as smartphones and tablets were exploited as gateway to IoT application [8] which further provide system-level intelligence. However, to comply with the vision of autonomic IoT and instantaneous intelligence, extracting and applying knowledge are necessitated for which this chapter proposes to integrate mobile edge computing (MEC) to further assist the distributed intelligence. It is clear that edge computing is capable of enabling real-time knowledge extraction which, however, cannot only be limited to fixed edge devices; therefore, the solution to enable MEC is gaining popularity which is further expected to be driven by 5G [3]. Mobile devices such as a smartphone or a tablet possess sufficient computational capabilities to employ as an IoT gateway [8].

The promise of IoT is going to drastically change the way we live integrating smart applications such as SmartHome, SmartGardening, and SmartHealth in our daily life. Mobile-based solutions are also being employed to complement these applications primarily for accessing data, receiving notifications, local storage, data filtering, etc. [8,9,10,11]. A mobile-based solution further can assist in extracting knowledge for IoT applications. Earlier, it was demonstrated that resource-constrained devices can be employed for intelligence at the IoT edge [2]; this chapter presents the feasibility of a mobile edge computing to provide intelligence by reaping value from IoT data. A typical IoT architecture follows three-layer architecture [2, 6, 8, 12], and intelligence has been proposed to be distributed between gateway and cloud layer as shown in Fig. 2.1. Building upon this idea, this chapter further proposes to employ a mobile-based solution to assist in the envisioned distributed intelligence. The chapter specifically looks at the feasibility of a SmartLiving scenario by exploring three IoT applications: SmartHome, SmartHealth and SmartGardening.

Fig. 2.1
figure 1

Distributed intelligence-assisted IoT architecture

2 Related Work

When IoT was first coined in 1999, it started with the vision of reducing human labour by collecting data without human intervention [13]. Since then, most research focused on proposing solutions to connect things and collect data. Gateway is usually employed to connect things locally and forward data outside [2, 6, 10, 11, 14]. In [10], reasoning in a SmartHome scenario was demonstrated for providing services where the gateway was employed to provide connectivity, translating protocols for data forwarding, etc. However, the reasoner was employed as a REST API which would store data and feed services to the users on their mobile apps. The approach too followed the existing approach of employing gateway only to connect things and collect data; further, capabilities of mobile device were limited only to a service application which would receive or request services. Recently, there have been few works which propose to add other functionalities to the gateway to improve living by bringing intelligence to the gateway. It was shown in [11] that a mobile phone can be used to control a home system based on human behaviour to reduce costs and save energy. The paper proposed to use a mobile phone as a default gateway whenever connected to the IoT application instead of the fixed gateway to the underlying network the aim of which was to reduce energy and stabilise the gateway further to reduce cost. A gateway controller was employed to manage the migration and synchronisation between the gateways. However, instead of migrating between gateways, combining the gateways’ capabilities would better suit today’s IoT requirements with respect to distributing computation, providing intelligence, real-time and faster decision-making, computation at the edge, etc. Although the proposal also makes use of user behaviour to dynamically control things in order to make the system intelligent, the intelligence is limited to recommending action to the users. However, intelligence with a mobile edge device can be extended beyond recommendation and enable decision-making, actions and predictions (DAPs) which were earlier demonstrated on an edge device [2, 6].

Rahmani et al. in [8] proposed a SmartGateway for healthcare systems to cater for system-level intelligence such as energy efficiency, scalability, interoperability and reliability issues. The work is one of the first attempts of exploring edge computing with IoT applications with respect to intelligence. It exploited a UT-GATE as the SmartGateway and demonstrated how system-level intelligence can be brought to the edge. The work also proposed lite local data processing but limited to raw data validation and notification service. However, making use of data at the edge is also feasible, which was shown in earlier papers in [2, 6]. It was shown that in addition to data pre-processing, e.g., contextualising IoT data, context-based decision-making, clustering, and reinforcement-based learning were also feasible at the edge of IoT. Although computation on mobile device is expected to be always evolving and improving, it is considered inherently as resource poor [15]. However, the authors envisioned that advanced algorithms such as facial recognition and language translation can be done on mobile devices [15]. They further proposed to use cluster of computers to compensate for the resource poverty of mobile devices and to improve processing power. Their solution was virtual machine based to provide a resource-rich cloudlet closer than a distant cloud the aim of which was to provide low latency, high-bandwidth wireless access. Although the solution resembles the idea of edge computing, that is, computing closer to the things, their solution still brings delay with respect to higher virtual machine launching time.

From this, we can visualise a solution which can use a cluster of resource-constrained devices, e.g., raspberry pies, to perform higher-level data processing and can further be complemented by the mobile devices at the edge. Motivated by future IoT requirement, earlier we proposed to provide distribute intelligence to both edge and cloud computing. The proposal exploited gateway to be explored to provide intelligence based on the small datasets prior to applying advanced data mining techniques to extract knowledge provide insight to the data towards enabling distributed intelligence. Mobile edge computing (MEC) was not explored in the proposal which as mentioned above possess potential to assist in providing intelligence. This chapter would explore the role of MEC to assist IoT with distributed intelligence. The proposal would be targeted at SmartLiving scenario since this holds better application of MEC, as it includes our daily life things. The next section describes the system architecture of the distributed intelligence-assisted IoT.

3 System Architecture

The architecture of distributed intelligence-assisted IoT can be used in most of the IoT applications, although the focus of this chapter is limited to a SmartLiving scenario which further includes SmartHome, SmartHealth and SmartGardening applications. Figure 2.1 shows the envisioned distributed intelligence-assisted IoT architecture, which includes collecting data, pre-processing, analysing data and making decisions. The figure illustrates that things are connected to edge controller(s), an IoT gateway that is capable of providing low-level intelligence is defined as an IoT controller in IoT [6], which is responsible for collecting data, organising the things, distributing and reasoning data. Each of these steps is demonstrated below along with distribution of tasks between edge controllers.

Data Collection

In an IoT scenario, anything that is identifiable, capable of sensing and/or actuation is regarded as a thing [14]. The thing communicates with gateway via wired or wireless communication medium where the gateway assigns an ID for the thing, if not already assigned. Thereafter, data is collected from the things which can then be disseminated using IoT data protocols such as MQTT, CoAP and DCXP [6]. Once raw data is collected using any of the IoT data protocols, the next task is to process the collected data, which has usually been carried out in the cloud until recently. Few of the local data processing including contextualisation can be carried out closer to the actual things at the edge. Local data processing, e.g., contextualisation, helps providing meaning to the raw data so that services can be provided or insight to the raw data can be inferred [1, 2, 6, 8].

Self-Organisation

In the environment that things immerse changes rapidly, where data is frequently communicated and as shown in Fig. 2.1, often, things might be controlled by more than one controller/gateway. The environment evolves over time as a result and this dynamic environment necessitates proper management with no or minimal intervention from outside sources. The configuration, discovery, duplicated identification check, optimising its performance and security of things all these system-level intelligences should be part of any current and future IoT gateway. Depending on the cloud to take care of the system-level intelligence is a thing of past for IoT. A self-organisation approach, therefore, can counter the challenge.

Publish/Subscribe

The collected data or the contextualised data, context information, need to be disseminated for further processing and/or for providing services based on the context. There are two actors in this regard, one which is disseminating and the other one which is acquiring the data. This is countered via a Publish/Subscribe (PubSub) model which both DCXP and MQTT protocols can handle. Both these protocols are capable of handling IoT data dissemination challenge and have been tried in IoT scenario earlier [10, 16]. The PubSub model consists of a broker which handles subscription requests and receives published items from the publishers. While mostly cloud has been the prevailing choice for the broker, it was shown in [10] that edge device can be utilised as a PubSub broker. Furthermore, a mobile device can also act as a broker for a PubSub model [17]. The paper further demonstrated the cooperation between the mobile broker and fixed broker. The system architecture portrayed in Fig. 2.1 exploits the similar idea, which advocates the distributed PubSub model via edge controllers. Each of the controllers acts as a broker for the PubSub model.

Reasoner

The role of reasoner in IoT is to extract knowledge. Context-aware reasoner enables extracting knowledge based on context [2, 14], which is expected to drive the future IoT. There are many methods to deduce knowledge by means of reasoning, such as naïve Bayes, decision tree, hidden Markov models, ontology-based, rule-based, fuzzy reasoning [14]. Rules and ontology-based reasoning have been the predominant reasoning methods employed in the IoT landscape. Furthermore, rules have been the prevalent choice for reasoning for inferring knowledge at the edge of IoT until recently. However, rules fail to scale well for the ever-increasing number of things as the required number of rules also escalates and at the same time rules fail in uncertain situations. To this end, earlier, we proposed to employ Bayesian reasoning to extract knowledge at the edge [2, 6]. This approach helps in reducing the requirement of the number of rules and is also able to counter the uncertain situations by reasoning based on prior belief.

Distributed Intelligence

As mentioned earlier that intelligence in IoT implies application of knowledge. After reasoner enables extracting knowledge, the extracted knowledge needs to be applied. Most of the earlier IoT solutions have proposed to employ cloud to provide such intelligence. However, it was predicted in earlier research that future IoT requires to move on from the central point of control [14]; earlier, it was shown that intelligence can also be distributed [6]. The idea was to employ both edge and cloud computing to provide intelligence based on the collected data where edge would take care of low-level intelligence (LLI) with respect to applying knowledge and high-level intelligence (HLI), e.g., advanced data mining solutions can be applied at the cloud level. Few of these LLIs were earlier discussed in [2, 6]. However, edge-intelligence has been limited to fixed edge devices while mobile devices can also be employed. The next section describes the role of mobile edge computing in the vision of distributed intelligence in the IoT landscape.

4 Role of MEC in Distributed Intelligence

In this section, the role of mobile edge computing in aiding IoT with distributed intelligence has been presented. In earlier sections, the importance of distributing intelligence and need for mobile-based edge intelligence were discussed. Table 2.1 shows few of the knowledge that can be provided at the edge of IoT in a SmartLiving scenario. Use of mobile for sensing, i.e., mobile sensing, has been common in IoT, and it was even employed as an IoT gateway which could provide automatic notifications to the users about health [8, 18], home [10], garden, etc. While [18] proposed to use a cloud-like solution to analyse data and use mobile screen to visualise data, in this chapter, it is envisioned that such tasks can be done at the edge by means of edge controllers.

Table 2.1 Application of knowledge at the edge

4.1 Data Collection and Pre-processing

Data from connected things can be collected both on a mobile device (Mobile Controller-MC) and/or on the fixed edge device (Fixed Controller [FC]). As shown in Fig. 2.1 that, different edge devices together form the edge controller part, each of these devices should be able to handle collected data. MC can collect data from things attached to a human body for SmartHealth scenario and from things related to SmartHome and/or SmartGardening. The first task, after collecting data, for an MC is to add contextual information for which any of the earlier context modelling methods, e.g., key value modelling, W4 diary, can be used and context information can be represented in XML and JSON formats [6, 14]. Figure 2.2 shows an example how raw data can be contextualised to provide meaning to the raw data (Adapted from [1]). It shows how raw data is first contextualised at the second step and the last two steps are obtained via reasoning the context information. Context information includes the actual sensed value and the originator and time. Location (Where) is also added but not shown in this particular figure. Context information is filtered before reasoning technique can be applied. This chapter explores the W4 diary context modelling, and context information is represented in JSON formats. Often data from different things is combined into a logical thing; MC can collect different sensor data related to health or home and it would then combine into one single data representation. All these data pre-processing steps are to be taken care by the edge devices including the MC. Moreover, there are certain connected things that communicate with the MC directly via Bluetooth, e.g., as well as via camera. One such example could be pictures taken of a patient or a plant and after pre-processing of the data, it is sent to the FC to find insight to the data—for instance, disease diagnosis of the patient and plant growth, etc.

Fig. 2.2
figure 2

Knowledge extraction from the raw data

Following this, context information should be filtered before a reasoning technique is applied. Often, one sensory data might be required by several applications. For example, a temperature sensor value might be required both SmartHealth and SmartGardening applications. A controller filters the context information and reasons who needs what and when. Earlier, it was shown that MC can also be employed to eliminate noise from the collected data with respect to electric signal as discussed in [8].

4.2 Mobile Edge Reasoning

As mentioned earlier, reasoning is employed to infer knowledge and mostly rule-based reasoning are used in that respect at the edge in IoT. Bayesian reasoning is a better alternative to rule-based reasoning. The approach was earlier demonstrated in [6] where each context information was given a prior belief and based on the belief of a certain task, a decision or an action was taken. Two simple formulas of sum and product are used in Bayesian machine learning belief calculation as shown in Eq. 3.1. It is the controller’s task to determine which context information beliefs are needed to make a decision or take an action. MC can play a vital role in such intelligence. The prior belief that is assigned to each context information is pre-determined, which can be personalised via users’ feedback on MC. Users can provide the prior-belief to each of the available context information in his/her SmartLiving application, which can be used to optimise the belief. Moreover, prior belief can be learned from the data and user’s interaction with SmartLiving. The learned belief can be sent to users on their mobile devices and asked for confirmation in order to update belief. In a futuristic IoT scenario, distributed edge controllers would be synchronised very quickly, probably within a millisecond, via 5G or very fast Internet speed. Keeping that in mind, we envisage that whichever controller—MC or FC—is able to respond first would respond first and synchronise the other controllers. Therefore, MC should be able to reason the context information. MC should be able to reason context information after filtering for each of the SmartLiving applications, which can be done by a Multi-Modal Context-Aware reasoNer (MM-CAN) [2]. Based on the outcome of the reasoning, decisions can be made by inferring knowledge.

$$ \Pr (A)={\sum}_{i=1}^n\left({\ss_{\mathrm{CI}}}^{\ast }{\ss}_{\mathrm{CI}\mathrm{V}}\right). $$
(2.1)

From Fig. 2.2, it is seen that the third step shows the raw data relates to ‘Elevated blood pressure’ and it could relate to ‘Hyperthyroidism’. Although this can be achieved by using rules, inferring the knowledge of ‘Hyperthyroidism’ disease based on single data might be misleading. This disease has other symptoms as well.

Therefore, these need to be taken into consideration while applying the knowledge. The mobile device can be helpful to monitor patient’s health condition and visualise based on the reasoning on the mobile device’s display screen. Some of the reasoned data for visualisation might come from FC, e.g., image classification of analysing disease. Another example in a SmartLiving scenario could be visualising plant growth on the user’s mobile device along with portraying what might be contributing to its growth. The MC might then provide intelligence to the user on which actions to take for the plant’s smooth growth. It can alert the user if the water is over-used or under-used. The application might be designed that it automatically sprinkles water when certain beliefs are fulfilled, and MC might analyse that one certain context is causing over- or under-watering. It would notify the user that particular context should be included into water sprinkle action, thereby optimising the decision-making. Learning from data is one of the useful roles that MC can play in the future IoT, which is described in the following sub-section (Fig. 2.3).

Fig. 2.3
figure 3

Mobile edge controller roles in SmartLiving

4.3 Mobile Edge Learning

Learning from data is usually done using machine learning techniques without explicitly programming how to learn. In such techniques, the more data an algorithm has, the better the performance is. However, while designing an IoT application such as SmartLiving application, even having historical data for that application might not be useful for the optimal performance. SmartLiving corresponds to daily life of individuals, and each individual is different. For example, if the SmartLiving application is to prepare food for its user without his or her intervention, it should take into consideration the context information corresponding to this specific user. For example, when the user usually eats his or her dinner, user’s food habits, if the user usually goes to meet a relative on a specific day, if the user has an appointment with someone on a given day, etc. Therefore, the learning algorithm needs to monitor each state of its user and learn from the experiences. Reinforcement learning enables in such vision of learning from experiences [6]. It observes the environment and gives a reward or a penalty based on the outcome. Similarly, this technique can be used in a SmartLiving scenario where the MC observes each state of the user with respect to the connected things. Whenever an action is taken or a decision is made, the MC learns it and gives a reward which is then used to reinforce the belief with a new belief. Once the rewards are collected, depending on the choice or time duration, belief can be learned from the application with the help of the softmax function. Softmax function is useful in providing probabilities of each input and has been used in artificial intelligence. It is mostly used in multiclass classification as well as in deep learning. It can also be used in reinforcement learning to find out the probability of each action as shown in Eq. 3.2 [adapted from 19]. It calculates probability as exponential of the reward of the action divided by sum of all exponential of all actions’ rewards and distributes probability to each of the actions based on the reward. The calculated probability is then exploited to update the belief.

$$ \Pr \left({a}_j\right)=\frac{e^{r(a)}}{\sum_j{e}^{r(a)}} $$
(2.2)

This approach can also be applied to predict any missing value. For example, if a thing that has lost connection or no longer able to provide data, a controller might need to predict the missing value in order to execute an action or make a decision. It is detailed in our previous work [6].

5 Discussion

The proposed approach concerns with utilising MEC to assist in distributed intelligence. In our previous work, it was shown how Bayesian reasoning enables to provide decision-making, actions and predictions (DAPs) at the edge with a fixed controller. In this work-in-progress chapter, the feasibility of MEC has been demonstrated on a mobile device. We have employed the same approach as demonstrated in our previous papers [2, 6]. It was earlier shown that Bayesian reasoning reduces the number of required rules, which is detailed in [6], along with how each context information is given a belief. For example, the maximum belief of an action is 1 (one), which is then distributed amongst the context information responsible for affecting that action. To illustrate the feasibility, the knowledge extraction that was shown in paper [2] for activating a sprinkler based on Bayesian reasoning has been consulted. Along with the Bayesian reasoning, rule-based reasoning has been utilised to demonstrate the difference and how MEC can be benefitted from Bayesian reasoning over rules based. Figure 2.4 shows performance of both Bayesian and rule-based reasoning performed on Samsung Galaxy (A5). The result clearly shows that Bayesian reasoning provides faster response for activating a sprinkler on MEC. Both the left and right images in Fig. 2.4 show the same result, where y-axis represents the response time in nanoseconds. It shows that rule-based reasoning require about 42% of higher response time compared to Bayesian reasoning for activating the same action. This result particularly could be beneficial in the future IoT where faster response is one of the sought-after performance metrics.

Fig. 2.4
figure 4

Mobile edge controller roles in SmartLiving

6 Conclusions

The true promise of connected things can only benefit us when intelligence of things is extracted in order to automate our surrounding environment by providing instantaneous and informed decisions. By automating our connected daily-life objects allows us to experience a true SmartLiving experience. Cloud computing and rule-based reasoning have been the predominant choice for enabling such experience. Earlier research showed that over reliance on them bring among other issues latency, centralised and scalability issue. Edge computing along with context-aware computing expected to play an integral role in future IoT landscape where artificial intelligence such as reasoning and learning are major challenges, especially at the edge. Mobile edge computing (MEC) can play an important role in reasoning and learning, which is driving current IoT research towards making sense of IoT data. This chapter portrays a solution based on MEC, which can assist in the envisioned distributed intelligence. The chapter laid down the foundation to employ a mobile device as an edge controller. While earlier research demonstrated the feasibility of utilising mobile device as IoT gateway and provide system-level intelligence, we extend the idea to enhance the capabilities a mobile device possesses to provide intelligence based on IoT data. To this end, in this work-in progress research with respect to making sense of data, Bayesian reasoning has been evaluated on the contextualised IoT data using a mobile device. The result suggests that it is feasible to contextualise IoT data and achieve faster response compared to rules on the mobile edge controller. These results contribute towards instantaneous and informed decisions at the edge which can enhance our SmartLiving experience.

The work presented in this chapter can further be extended. The proposed learning approach can be implemented and its feasibility can be investigated. Currently, we are working towards employing deep learning on both fixed edge device (raspberry pi) and mobile device to learn from the IoT data. Its feasibility to improve SmartLiving is one of the future works we are focusing currently, especially diagnosing disease and monitoring plant growth at the edge to improve healthcare and farming. In the future, interoperability and dynamic behaviour between edge controllers, and edge and cloud controller interoperability should be examined. Intelligence and security are the two outstanding issues in the current and future IoT. Therefore, security in IoT needs to be explored from the distributed intelligence perspective.