Monday, October 24, 2016

How to teach computers to understand images

One of the most fascinating area in Artificial Intelligence is Image Recognition.
In 2007 Stanford and Princeton Universities started a big project: ImageNet

They have built a very large database of labeled images.

Then, at Stanford’s Artificial Intelligence and Vision Lab they have developed Deep Learning models, based on Neural Networks, enabling computers to “understand images”.

This Ted talk tells you the entire story

Really interesting. A wonderful example of application of Machine Learning.

Tuesday, October 18, 2016

Thinking about models

I was reading a paper on Machine Learning Algorithms and I came around this sentence:

“All models are wrong, but some are more useful than others”.

Interesting.
It suggests that even if you have done an hard work and developed a really complicated model, you should always be careful and try to understand the limits of the model.
See you soon.

Saturday, October 15, 2016

Arduino MKR1000 and IoT

Arduino is the most used prototyping board (well, actually it is a family of boards) in the world, and I have to tell you that I’m proud that it has been designed in Italy.
Recently, Arduino has entered at great speed in the IoT world. One board that is really interesting is Arduino MKR1000 (MKR stands for Makers!). A very small board, with built-in WIFI, enough cheap.

I have bought one at Maker Faire 2016 (in Rome, obviously) and this evening, after some soldering, I have decided to give it a quick try.

Obviously, my first choice was to test if it is easy to send an MQTT message from MKR1000.

Well, I have to tell you that it has been really easy.

1. Use WIFI101 library
2. Use PubSubClient Library (by Knolleary) for Arduino (C/C++)
3. Use one example sketch from PubSubClient Library, slightly adapted
4. To make it simple, the MQTT broker used is Mosquitto, running on my MacBook.

Et Voila, it has worked.
I can go to eat something. I’m happy.
See you soon.

Sunday, October 9, 2016

Machine Learning demystified

Risultati immagini per artificial intelligence
Another important area where my interest lands, from time to time, is Machine Learning.

If you really want to transform your City, your House, your everything in a “Smart SomeThing”, you not only need to be able to collect data, but also to get real and useful insights and intelligence from these data.

Here Machine Learning comes into the game.
But, for many people, Machine Learning (ML) is a much more intimidating subject than IoT, for several reasons.

First, mastering ML requires, without any doubt, a certain degree of preparation in Mathematics.
You need to understand and master Matrix Algebra, Derivatives and Calculus. You need to understand Probability Theory.

But I think that, in some way, Machine Learning is made more obscure because most of the terminology used tries to create a sort of “wonderful world” where we really see the realization of the Promises of Artificial Intelligence (AI).
Do really Machines Learn?

I have to tell you that the first time I understood what do they mean for “learning” I thought: “Ok, as always IT is trying to be more fashionable than Woman Fashion”.
Let me tell you that Machines Know no more no less what we put in a Model. (But at the end of the post I will tell you why they discover what you don’t know).

One of the approach used in ML is the so called Supervised Learning.
in Supervised learning you’re studying some phenomena where you want to make predictions. For example you want to be able to forecast what will be the power consumption in a certain area of your country in order to decide if the Power Company can handle it or need to buy additional power on the market.
You have a set of data (Xi, Yi) where Y is the power consumption, and Xi is a set of variables Y is depending on.
You think you know, based on your understanding, what is the functional dependence (You know it and you tell to the machine)

Y = F(Xi)

but you need to estimate some parameters of your model.
The set of data (Xi, Yi) are usually split into two subsets: a “training set” and a “test set”. You will use the training set to estimate the parameters of the model and the test set to verify how good the model is.
To be more precise, for example, your model can be linear as dependency on the parameters, and in this case you will use a ML method that is called “Linear Regression” to estimate the parameters from the training set.
You will use, for example, the Gradient Descent method to calculate the best estimate of the parameters.

Now, the question: is the Machine Learning? Yes, it is, in the sense that the Machine is calculating the best set of parameters starting from the training set. And therefore the best model. If in the future you have more data, you will repeat the sequence of steps and will arrive at a better estimation for the parameters.
So, in this case, Learning means simply: estimate the parameters of your model from the “training set”.
But…. there are ML methods much more sophisticated. For example when they talk about “Deep Learning” normally they’re using Multi-Level Neural Networks models.
Here you can have models with many layers and millions of parameters,
After you have calculated the parameters you can fully exploit your model and make predictions or decisions.
For example, Neural Networks can be used to recognize the license plate from a photograph made by a Smart Traffic-Light. This is an example of Image Recognition.

In the case of IoT, normally you have a large amount of data streaming from all the devices. In this case you cannot think to do the “training” in real-time.
Therefore you adopt what is called a “Lambda Architecture”. You duplicate the data.
One copy is sent to the so-called batch layer, where in batch mode the model is re-evaluated with a hourly/daily/weekly frequency (or whatever could be feasible).
Another copy is sent to the speed layer where it is used real-time (and maybe one model is applied to this data to decide and react).
In IoT ML raises some more challenges: you have a large amount of data (Volume), coming at High Speed (Velocity). You need not only good ML algorithms, but also scalable and performant to be able to handle the amount of data. Here ML merge with Big Data.

I’ll come back on the Machine Learning Subject soon.

Tuesday, October 4, 2016