Machine Learning and the Internet of Things

Mayank Joneja
Bolt IoT
Published in
6 min readNov 1, 2017

*Internet of Things...Internet of Everything!.. Cloud!.. Machine Learning!..Artificial Intelligence! Neural Networks… Robots are taking over! We are all going to die.*

IoT Hype Cycle 2016 (Have a look at the peak and the X axis)

Not yet. You may hate buzzwords, or love them, but when things gain momentum, you definitely cannot ignore them. This article tries to cover the basics of IoT, Cloud and Machine Learning in an accessible fashion.

(Note: This background research was done as a part of developing features for Bolt IoT. We’re aLIVE and kicking on Kickstarter! Back us and spread the love :D)

IoT, Cloud, ML

The Internet of Things (IoT), refers loosely to the connection of objects (doors, shipping containers, water tanks or your jazzy RGB light bulb), to the Internet.

This connection is done through IoT sensors/actuators with some local processing to enable “smart” capabilities. This means that the Internet has already transformed from being a network where humans share data and connect, to Things doing the same, with, or without the need for human intervention and monitoring.

How does this affect you? Well, the benefits include automation of complex tasks like automatically drawing the blinds in your office room in case its too sunny outside. Yes, IoT will allow us to be more efficient at being lazy, and you won’t get scolded by your mom because the lights in your room will turn off automatically when you leave.

Additionally, IoT helps businesses collect a large amount of data. This data helps them understand the environment and processes better, which allows them to take more optimal business decisions in all sectors ranging from logistics, medicine and healthcare to agriculture or even building management.

A concept which goes hand in hand with IoT is that of the Cloud. The “Cloud” is essentially a data storage, computation and processing resource which practically is made up of servers in a data center distant from the point of deployment of the IoT nodes. This allows for the use of relatively “dumb”, low-cost and less power-hungry devices as IoT sensors, while the “Cloud” resource on the Internet does all the heavy lifting in the application.

Once the data from the IoT nodes (called the “Edge”) enters the “Cloud”, data analytics and statistics can be leveraged to draw the inferences we need for our particular use-case. For instance, energy consumption of appliances in a household can be measured using internet connected sensors at the Edge, while advanced data analytics such as analysis of usage patterns, consumption by geographical location or visualizations of such data can be done in the Cloud.

The Internet of Things and the Cloud

In recent years, more sophisticated data analytics techniques have become popular which improve upon themselves without being explicitly programmed. Such techniques, or algorithms, collectively come under the umbrella term of “Machine Learning” (ML).

ML algorithms, especially one popular class called Neural Networks, have shown immense power in dealing with large datasets of images and videos for applications in the domain of image processing.

Neural Networks can also deal with other data like sound for natural language processing and audio event detection. However, there are quite a few ML algorithms which can be used for applications with simpler IoT sensors as well which measure quantities like temperature, humidity, soil moisture, acceleration and light intensity.

Main Uses of Machine Learning in IoT

1. Prediction of data trends:-

Regression algorithms are the class of algorithms which help estimate the trend of the data points by formulating a model based on existing collected data.

The simplest regression algorithm is Linear Regression which is used to fit a straight line to data which is following a linear relationship between the quantity measured by the sensor, and time.

Often the data does not follow a linear relationship and more complex approaches such as Polynomial Regression and more sophisticated algorithms have to be used. A simple use case for predicting trends of temperature data has been included in our title video on our Kickstarter campaign :).

UPDATE (2/11/17) : Linear Regression could also be used for non-linear trends if you are ready to prepare the modifications of the independent variable you want to run the regressor.

The state of the art Machine Learning algorithms used for prediction in the case of IoT sensors i.e. time dependent data include Recurrent Neural Networks (RNNs) and Long Short Term Memory (LSTM) Networks.

However, to get started with understanding prediction, linear and polynomial regression are a good place to start.

2. Clustering of data:-

Another use-case related to IoT which can harness the power of ML algorithms is that of classification of data. For Binary classification (i.e. Hot or Not..with a temperature sensor, of course), Logistic Regression (yes the name is deliberately confusing) is the best place to start. An application could be analysis of accelerometer, gyroscope and other Inertial Measurement Unit (IMU) data to identify behaviors such as walking, standing, running or sitting.

Other sophisticated approaches include using Random Forest classification, Support Vector Machines, k-Means clustering or k-nearest neighbors.

3. Anomaly Detection:-

A third use-case which is strongly applicable for IoT is Anomaly Detection, i.e. identifying outliers in a data-set. For instance, if your temperature sensor itself goes bad, and starts giving an output of 10 degrees Celsius out in the sun in a desert in summer, you would definitely want to detect such an anomaly.

Or for instance, if your washing machine is vibrating in a weird fashion, you would want to know before the motor breaks down and you cannot do that large batch you’d been putting off for 10 days…[Check this out! :D https://blog.boltiot.com/washing-machine-learning-with-bolt-iot-4eb7a1d732c1].

Statistical approaches to Anomaly detection involve Gaussian distributions and analyzing how far away the data point to be tested is from the historical data’s mean. Z-Score is a commonly used metric for parametric distributions for this purpose and depends on the mean and standard deviation of the data (although it is most effective when the data conforms to a Gaussian, also called normal distribution).

Deploying solutions

In practice, while developing IoT solutions, you don’t need to implement all these algorithms from scratch, several machine learning libraries are available like TensorFlow, Keras, Apache Spark which ease implementation.

In terms of cloud platforms, the major enterprise solution providers distinguish between IoT cloud solutions, and the Machine Learning Cloud solutions. For instance, Amazon with AWS IoT for the device management and data collection and Amazon Machine Learning for the ML part. Microsoft has developed Azure IoT and Cortana Intelligence for ML services. IBM offers Watson IoT and Watson Machine Learning. Bolt is another such fully integrated IoT cloud and hardware offering ready for Machine Learning.

Additionally, an open-source tool, Node-RED, an easy to use graphical programming framework can also be used to develop simple flows as featured in our Halloween post: Building an interactive Jack-O’-Lantern with Bolt IoT

Other Resources

  1. Andrew Ng’s Machine Learning course: https://www.coursera.org/learn/machine-learning
  2. https://www.leverege.com/blogpost/machine-learning-applications-in-iot
  3. https://en.wikibooks.org/wiki/I_Dream_of_IoT/Chapter_4_:_IoT_and_Cloud_Computing

With free images thanks to https://pixabay.com

WE ARE LIVE NOW! Bolt is launching on 3rd of November 2017 (6:45 p.m. IST i.e. 8:15 a.m. CT) on Kickstarter.

To know more about Bolt IoT platform, check out our website. To know what other interesting projects can be built on Bolt you can check out the Docs section on Bolt Cloud.

--

--