Applying Machine Learning to IoT


Machine learning in conjunction with IoT will play an increasingly important role in our lives as the days go by, as both are fields of computer science that are currently in a rapid state of development.

We are undoubtedly becoming ‘smarter’ in various aspects of our daily life, with IoT and machine learning (ML) playing a crucial role in this. Well known thought leaders like Bill Gates and Dr Judith Dayhoff (author of ‘Neural Network Architectures: An Introduction’) say that the IoT has given our physical inanimate world a digital nervous system. IoT has really exploded over the past three years, demonstrating its potential in applications ranging from wearables and automated cars to smart homes and smart cities, creating an impact everywhere. According to recent research by Gartner, there are around 16 billion devices connected to the IoT now and this is expected to rise to 25 billion by 2020. All such connected devices generate a deluge of information that needs to be monitored and analysed, so that they learn continuously from the available sets of data and improve themselves without any manual intervention. That’s how IoT devices are becoming smarter.

So how will such a large ocean of data get analysed and monitored? This is where the role of machine learning comes in. There are different ML algorithms and techniques that are implemented to easily analyse massive amounts of data in a short span of time, increasing the efficiency of the IoT. Also, different ML techniques such as decision trees, clustering, neural and Bayesian networks, help the devices to identify patterns in different types of data sets coming from diverse sources, and take appropriate decisions on the basis of their analysis. Such challenges are faced especially in the case of embedded systems. The most important thing is that there is no programming or coding support given to these devices all through this process. Hence, it would not be wrong to say that if the IoT is the digital nervous system, then ML acts as its medulla oblongata. Without implementing ML, it would really be difficult for smart devices and the IoT to make smart decisions in real-time, severely limiting their capabilities.

Figure 1: The future of IoT (Image source:
Figure 2: Increase in business operations with machine learning in IoT

The IoT helps in the inter-networking of different physical structures and hardware devices—buildings, vehicles, electronic gadgets and other devices that are embedded with the actuators, sensors and software, so that they can collect and exchange data between each other. While the Internet of Things is still in its infancy, it has become very clear that it will soon be a part of everyone’s life, if that is not already the case. As different companies realise the revolutionary potential of the IoT, they have started finding a number of obstacles they need to address to leverage it efficiently. Many businesses and industries use machine learning and, more specifically, the ML-as-a-Service (MLaaS) to exploit the IoT’s potential.

Machine learning is basically a part of computer science that makes any system smart enough to learn on its own without actually being programmed for that task. It helps a system or device learn in the same way as humans learn by themselves. As we learn any type of system on the basis of our experience and the knowledge that is gained after analysing it, machines too can analyse and study the behaviour of a system or its output data and then learn how to take different decisions on that basis. Recently, there have been many factors that have come together to make ML a reality — large data sources, the increased computational power required for processing the information in split seconds, and different algorithms that have become more reliable. Machine learning can be used in different scenarios such as when the required outcome is known (supervised learning), when data is not known beforehand (unsupervised learning), or when learning depends upon the result of the interaction between any specific model and the environment (reinforcement learning).

The main purpose behind ML is to automate the development of different analytical models to enable algorithms to continuously learn with the help of available data. Google’s self-driving vehicle is one such development that uses different ML techniques with IoT to create a completely autonomous vehicle. It combines the advanced features of different modern cars (like speech recognition, lane assistance, adaptive cruise control, parking assistants and navigators).

IoT without ML

IoT undoubtedly uses the Internet in an amazing manner, but there are still some challenges, particularly if it’s implemented without ML. Humans have never played around with so many devices generating such huge amounts of diversified data, ever before. Let’s have a look at some of the challenges facing IoT without ML.

Device diversity and interoperability: There are so many industries and companies offering products and services in a single domain. In the case of a smart grid, there are so many kinds of sensors that measure the power consumption from various organisations and corporations, all operating based on different standards. To keep all such devices and sensors working together is really a big challenge, which ML can potentially overcome.

Figure 3: How AWS IoT and Salesforce IoT work (Image source: googleimages)

Device management: We know that there are a large number of small devices connected to any smart system. All of them need to communicate with each other and also to servers spread over large geographical areas. So in all such cases, there are possibilities that devices may not be able to connect with each other—there might be several data linking issues that need to be managed efficiently. For instance, you may want to open a front door remotely but the command used to open the door needs to be transmitted through the light in front of the door. This requires all devices to be managed in an elastic topology such that the communication between each of them happens smoothly.

Integration of data from multiple sources: When we deploy an IoT application, we will inevitably gather abundant diversified data from different sources such as sensors and actuators, as well as contextual data from various mobile devices, social network feeds and so on. To create and build the connection between all that data can really be a big challenge without ML.

Scalability, data volumes and performance: We need to prepare our businesses to manage the scalability, the large data volumes, as well as the speed at which different devices connected to the IoT generate the data. This is actually a common Big Data problem to be dealt with. For IoT, the analysis and handling of data needs to be in near real-time.

Flexibility and how applications evolve: Different devices and sensors will continue to evolve with new capabilities and improved functions. This will lead to the creation of new use cases and also new business models. We will need to quickly develop our products with minimal effort using certain frameworks in order to catch up with the pace of changing techniques. To enable and sustain this, we need different ecosystems and platforms to support us. Machine learning can actually provide this.

Figure 4: ML and IoT used in roouting traffic (Image source:

How ML increases the efficiency of IoT

  1. 1.There are some data models that implement traditional data analytics, and these are often static and of limited use when it comes to addressing rapidly changing and unstructured data. But when it comes to IoT, it is often necessary to identify the correlations between dozens of sensor inputs and various external factors which are producing millions of data points. We know that traditional data analysis needs a model that is built on past data and also an expert opinion to establish a relationship between different variables. When it comes to ML, it directly starts with the outcome variables and then automatically looks for different predictor variables and their interactions. Hence, ML is really valuable when we know what we want but do not know the important input variables to come to that decision. Different ML algorithms learn from the sets of data that are important in achieving that goal.
  2. Machine learning is quite valuable for accurately predicting future events. All the different data models that are built using traditional data analytics are static, but various ML algorithms constantly improve over time as more data is captured and assimilated. This indicates that the used algorithms can make predictions, compare against their past predictions, see what actually happens and then adjust to become more accurate.

  3. The predictive capabilities of ML are extremely useful in industrial settings. By drawing the data from multiple sensors present in or on machines, different ML algorithms can actually learn whatever is typical for the machine and also detect whenever something abnormal starts occurring.

  4. Machine learning helps to predict when a device connected to the IoT needs maintenance; this is incredibly valuable, translating into millions of dollars in saved costs. For example, Goldcorp, a mining company, is now using ML to make predictions with over 90 per cent accuracy about when maintenance is required, hence cutting costs considerably.

  5. We all know that Amazon and Netflix use ML techniques to figure out our preferences in order to provide better experiences for us, suggesting different products that we might like and even provide relevant recommendations for movies and TV shows. In the case of IoT, ML can be extremely valuable in shaping our environment to suit our personal preferences. For example, Nest Thermostat uses ML to learn how hot or cool we like our homes to be, ensuring that the house is at the right temperature when we get home from work.

  6. In any IoT situation, ML can really help different companies take the billions of data points that they have and distil these down to whatever is really meaningful to them.

  7. To analyse any set of data from the IoT in real-time (in order to accurately identify the previously known and the never-before seen new patterns), all machines capable of generating and then aggregating such Big Data are allowed to learn normal behaviour using ML and uncover anything outside the norm.

Major ML techniques implemented in IoT

Artificial neural networks: This type of learning technique is also called neural networking. It is basically a learning algorithm inspired by the structure and functional aspects of biological neural networks. Various computations are actually arranged in terms of an interconnected group consisting of artificially designed neurons. This helps to process the information using the connectionist approach. All different modern neural networks are non-linear statistical tools, which are used for data modelling. They are basically used to model the complex relationships between inputs and outputs, to find the patterns in the data.

K-means algorithms: This addresses a widely used node clustering problem as it has linear complexity and also a simple implementation. The K-means actually steps in to resolve different node clustering problems. It randomly chooses K nodes to be initial centroids for the different clusters. It labels each of the nodes with its closest centroid using a distance function. Then it re-computes the centroids using current node memberships. It stops if the convergence condition is found to be valid; else, it cycles back to the previous step.

Inductive logic programming (ILP): This is a method used to rule the learning system with the help of logical programming as its representation for different input examples, background knowledge and the hypotheses. If we have the encoding of any known background knowledge with specific sets of examples that represent a logical database of the facts, then a hypothesised logic program can be derived using an ILP system. This entails all the positive and no negative instances, and accepts any programming language for representing the hypotheses.

Clustering: This is a technique used for the assignment of different observations into various clusters (sets) so that all the observations present within the same cluster are similar according to some pre-designated criteria. But all the observations that are drawn from different clusters are dissimilar. Different clustering techniques use different assumptions on the structure of data. This is often defined by using some similarity metrics and is then evaluated. It is an unsupervised learning method.

Bayesian networks: This is a kind of probabilistic graphical model that represents a set of random variables with all their conditional independencies by making use of a directed acyclic graph. For instance, it can represent the probabilistic relationships present between various diseases and their symptoms. If we know the symptoms, then this network can easily calculate the probability of the presence of various diseases.

Decision tree learning: Decision tree learning is a type of ML technique that uses a decision tree as its predictive model. This model maps the observations about an item to different conclusions about the target value of the item.

Association rule learning: This is actually a method used for discovering different interesting relations between all the variables present in large databases.

K-nearest neighbours: This is a supervised learning algorithm which classifies a data sample (also called a query point) on the basis of the labels (also called output values) of the nearby data samples. Basically, this algorithm classifies the K kinds of clusters such that the distance inside is minimal. This is a type of general classification algorithm.

Figure 5: IoT market statistics for the future (Image source:

Application of ML in IoT

In the energy sector: Arduino MEGA is used to reduce the energy cost for a coffee machine. This is one of the simpler implementations of ML with IoT. But these techniques are also being implemented in lights and air conditioners connected to the IoT.

In routing traffic: The combination of different sensors and ML algorithms is widely implemented for routing traffic. One such implementation is in a system using the LarKC platform, shown in Figure 4. The data from the traffic and weather can suggest several routes to the same destination.

In the home: IoT applications are extremely suitable for the home and are being widely used in home automation. They are implemented in apartments for light and humidity control as well as with temperature sensors. IoT is also applied in heart rate sensors.

In industry: There are several companies and organisations that use IoT and ML algorithms for health care, traffic management, etc. In manufacturing industries, considerable human resources can be saved with the help of an IoT system that uses cameras and controllers.


Please enter your comment!
Please enter your name here