Machine Learning for everybody: What and Why

Think about your phone for a second, it’s quite smart, isn’t it? I mean, you can talk to it and it actually understands you! Isn’t that crazy? Ever wondered how that works? Here you’ll find everything you always wanted to know about AI but were too afraid to ask.

Machine Learning for everybody: 
What and Why

First of all, I want to be honest with you, my very good friend reader. The goal of this post is to go over the ideas and basic concepts of machine learning without getting too deep into the math and little nuances, so that anyone can get a grasp on the subject. Now, I’m no John Machine Learning, but I will try and explain what’s all this about with the best of my ability. Writing this was a good excuse to get a better understanding about it myself, so I’ve already won, but I hope you can get something out of it as well. Since this is a complex topic, on this post we’ll just talk about what machine learning is and why it’s useful, and continue with how it works and how to actually do it in future posts. Alright, let’s get to it.

Computers are dumb. They can only do what we explicitly tell them to do, and even then, we have to explain them how to do it in abundant detail. We should make them smart so they can do amazing things like understand our language, predict the future and even find Waldo. So, how do we get there? Well, you know what they say: give a machine some code and you feed it for a day, teach a machine how to make its own code and… future?


What is it?

So, usually when you want a computer to do something, you make a program that does the actual work. You know, you write code that explains what you want so that the machine will understand and follow it to the letter.

In machine learning, instead of relying on instructions and algorithms made for a specific task, we make the machine learn from a bunch of data by finding patterns to build models that can make predictions or decisions about the particular subject it learned. In short, what we humans program here is not the software that does the thing, but rather the middle-man that takes in the data and generates the program that will do what we actually want. What's more, some programs even keep learning as they work over time, improving themselves and becoming more reliable.

Say you got a computer hooked to a camera so that it can “see”. That’s nice but not enough, we’d want it to understand the picture in some way. Imagine the computer being able to recognize things in a picture, identify faces, know if they are smiling, what gestures are being made, etc. Programming all that would be awfully complicated, ain’t nobody got time for that. Wouldn’t it be nice if we could show pictures of faces to the computer and say “This is what faces usually look like” and then the computer would get the general idea of a face? Then, the computer could generate a program to identify faces based on what it thinks a face is. Makes sense, right? The program it would make could be something like

if(number of eyes = 2)
    if(there is nose and mouth)
        its a face!
    else
        not a face

I’d say that bunch of `if`s asking for features present on a face seems like a reasonable approach to determining if something is a face, but there are many options. I know, I know, real devs don’t use `if`, but I’m not the one writing code here so my conscience is clean; shame on the computer, though. Anyway, we’ll see more about this in the next post.

Why do we want it?

Computers are pretty handy tools, they really make things a lot easier for us. They can tell us what's the fastest route from home to work, upload the seven thousand pictures we just took of our puppy sleeping to the internet in a few seconds and many other useful things. However t̶h̶e̶y̶ ̶c̶a̶n̶'̶t̶ ̶l̶o̶v̶e̶  there are some tasks that are quite hard to explain to them. Luckily, we don’t have to, as long as we’re applying machine learning techniques. Consider the following example:

A telephone company wanted to know which of their customers were in high risk of leaving them for a competitor, so they could offer them a better deal to hopefully retain them. At first they tried calling all their customers one by one, asking if they were happy with the service, which problems they had, all that stuff. That was terrible. Not only was it very slow, people often weren’t very willing to answer the questions. So someone said: “Let's use computers, they are fast!”. The computer handled the calling themselves, asked the customer questions and registered the results. Sure, a little more efficient, but still not great at all, people still wouldn’t provide good answers. Unable to get feedback from their current customers, a new idea popped up, the old customers! Of course, they had the information of the customers that had already left! Information about their activity before leaving (how many times a day they used the service, for how long, how many times they called customer support, how much they were paying, if they were having issues, etc.). So, they fed all that into a computer, then the computer stared at that data. It stared at it so hard it learned patterns about their behaviour. So, with a computer that knew how unhappy customers behave they found themselves with an incredible tool. If it detected a customer was, for example, calling support 50 times in 3 days while not having service for a week, it would say "I've seen people do this before leaving us!" and raise that flag so that appropriate measures could be taken. Unfortunately, as even the best detectives do, it wasn't able to catch them every single time, but it sure learned from the ones that got away to make better predictions each time.

While this is incredibly useful, it doesn’t stop at making predictions and decisions. There’s plenty more we can do, check it out:

I mentioned how you could teach a computer how to see, like this dude walking around with a computer that recognizes what it sees, or this one that identifies your poses in case you want to do some jojo references. Not interested in images? Maybe text to speech? speech to text? Text analysis? Yeah you’re probably used to this ones, so not very impressive. Maybe something that synthesizes sound by mixing instruments (this post was not sponsored by google, they just made a lot of stuff) or generates music? So far we have turned images into text, sound into text and text into sound. We can also transform text into images and even images into new images . And who could forget DeepDream? Certainly not me, not with the nightmares it gave me.

Cool stuff, ain’t it? Let’s wrap it up here, for now. Hopefully some of that was interesting to you, maybe even leave here knowing a little better what’s this all about. There’s still a lot of interesting ideas to talk about, so don’t think it ends here. On the next episode of this post I’ll talk about how the computer learns, so stay tuned. See ya!