Introduction to machine learning

Shubham Jayawant
Quartifex
6 min readFeb 25, 2017

--

Computers. Exceptional devices, aren’t they? Who would have thought that just a simple assembly of plastic and silicon components can do mind boggling things. Whether it is driving cars, flying airplanes, analyzing satellite captured images or even checking up patients, they can do it all!

Ever since computers were invented it has been every researcher’s dream to make them smart and intelligent. And why shouldn’t it be, wouldn’t it be cool if your computer tells you what to wear on your first date? Or comes up with witty responses during the conversation? Or tells you topics to talk about with your date?

I’m pretty sure after coming to know about these applications of intelligent computers, creating one would have become one of your dreams as well. The field in computer science which deals with these kinds of crackerjack things (not dating in particular) is, Machine Learning.

So, what exactly is Machine Learning?

The way I understand it is that, it’s a phenomenon which enables computers to yield accurate results or make wise decisions by themselves without requiring to be explicitly programmed for the same.

You might be wondering how they do it, since they do cool stuff without being hard-coded for doing so. The concept used is pretty simple. Rather than feeding computers with programs, they’re fed with number of examples.

The set of these examples is called as ‘training set’. Using the examples from training set, computers adjust certain parameters also referred as ‘weights’ in order to reduce error in the output. This procedure of accessing each example from training set and adjusting weights accordingly is carried out for all the examples present in the training set.

Once the entire training set is traversed, one iteration is said to have been completed. To achieve highly accurate results, your training set should be sufficiently large (varies from application to application) and number of iterations carried out over the training set should be adequate (we’ll discuss in the coming blog posts how much this ‘adequate’ actually is).

That’s how majority of the ML algorithms work. During the training period they work on minimizing the error in the system and during the testing period they make use of their earned knowledge base to solve given problem. Depending upon the nature of these algorithms, they can be divided into 2 types.

a. Supervised learning algorithms

To understand this type of algorithms, read this little story. Imagine yourself to be a student who is really weak at mathematics. So, in order to get better at it, every day you go visit your mathematics professor, who knows answers to all the math problems in your textbook.

After you solve any problem, the professor checks your final answer and tells you whether it is correct or wrong. If you get it wrong, you ask for the problem’s solution. After going through the solution you make sure that you don’t repeat the same mistake again. This improves your problem solving ability. As a result of which you become able to solve math problems which do not belong to your textbook and answers of which are not known to your professor as well.

This is how supervised learning algorithms work, during the training period, for every input from the training set, they calculate the difference between the expected output and the one produced by them. Then they try to minimize that difference by adjusting weights. This enables them to process inputs which do not belong to their training set.

b. Unsupervised learning algorithms

In case of unsupervised learning algorithms, the supervisor who tells the algorithm about the expected output for any given input is not present. The algorithm learns things by itself. It is free to carry out any kind of operation over the input set. After going through the input data it can identify special patterns, come up with certain conclusions or even make various predictions.

The GIF above demonstrates a good example of unsupervised learning where the bot learns things on its own and comes up with a conclusion.

Since this is an introductory blog post I won’t take you through any more theoretical stuff, instead, we’ll do a fun thing.

Have you guys ever thought of competing against AI programs? Well, I thought of doing so and did it as well. And for the competition I chose a thing I am really good at. Coloring! I really like coloring things and I’m pretty sure many of you guys love it as well. So, I decided to put AI coloring engine to the test and then compared our results. Here’s how the competition went.

Me vs. AI

So the rules of this competition were pretty simple. We were supposed to fill colors in an image. And it was not a normal image, it was a ‘grayscale’ (or ‘black and white’ as many people like to refer them) image. And the winner was going to be the one whose color filled copy of the grayscale image looked more realistic to human eyes.

Have a look at the results yourselves.

Well, what can say, at least I tried.

Surprisingly, AI engines are really good at this. In fact, this little game which I played against the AI engine is known as ‘colorization of grayscale images’ and nowadays it has become a real hot topic for research in the field of deep learning.

These engines require to be trained over number of grayscale images with the corresponding colored versions of these images being expected outputs. Once they’re properly trained they can even colorize ancient grayscale photographs. Now that’s really cool considering the fact that they’re doing certain thing which is practically impossible for humans.

(The link of the website of the colorizing engine I used is here. The algorithm being used here for colorizing the images is different than the conventional techniques and its results are promising. For more information regarding image colorization you can visit the aforementioned website. You can even colorize your old photos there.)

So that’s it for this blog post. In the coming blog posts I’ll be taking you guys through various deep level concepts of machine learning, in a fun way of course. We’ll be coding for stuff which you thought only your nerd cousin could code for.

The next post is going to be about basic concepts of machine learning in which we’ll make an AI chess engine. So don’t forget to check that out once it is out.

If you have any queries you can put those in the response section below. If you liked this post you can share it and follow my publication in order to get notified whenever I post anything.

--

--