Machine Learning

Machine Learning is an amazing field to work on, especially nowadays with the explosion of services that want to be “smart”. This post touches the surface of what Machine Learning is and what it can do. Enjoy!

1. What is Machine Learning?

Machine Learning (ML) is a branch of Artificial Intelligence focused on algorithms that can automatically learn to recognize complex patterns and make intelligent decisions based on data. In other words, machine learning is about computers learning to do better in the future based on what was experienced in the past[1].

This idea of “learning by example” is illustrated in Figure 1, where a ML algorithm builds a model from some data for which the answer is known (labeled). A model is what is resulted from the learning process, the rules that were observed to govern the data. That model is afterwards used to make predictions for new and unlabeled data. These general principles are valid for pretty much all ML problems, although there are some variations based on the types of predictions that we make.

Figure 1: Typical machine learning problem

2. What exactly can we do with Machine Learning?

Let’s quickly dive into an example to see what we can accomplish with machine learning.

Context: you are the owner of an online wine shop and you’ve managed to gather some data about the buying behaviour of your customers. More specifically, you have several records of the form (customer age, $ spent in shop per visit). You have plotted the data as shown in Figure 2 (X axis shows the age of the customer and Y axis shows the amount spent by that customer):

Figure 2: Wine Shop Customer Data

Problem: Each time a customer comes to your site, he gets some recommendations based on his age. But the current system is not very smart – for example, many times the system recommends bottles of wine that cost $30+ to 25 years old customers and this does not seem to be consistent with the data. Can the recommendation system be improved?

The answer is of course YES. In fact, if we just look at the data it seems that there is a correlation between the age of the customer and how much he/she spends in the shop. The question we really have to answer in order to improve the recommendation system is “Knowing the age of the customer, how much is he/she willing to spend in the shop?”.

Figure 3: Fitting the data

Because this is a simple example, we can “solve” it manually – the blue line in Figure 3 seems to fit the data pretty well. We consider this example to be simple because there is only one feature to consider (the age of the customer). Looking at 2 features (e.g. customer’s age and income) can still be handled by humans. However, as we take into account more and more features (gender, location, job, preference for red/white wine, etc.) we’ll start to be overwhelmed by all the data and we won’t be able to easily visualize it in order to make predictions. Nevertheless, (sometimes) where humans fail, computers succeed: computers are really good at processing huge amounts of data. The basic idea is to develop algorithms that learn from the data (in this case, algorithms that try to predict how much the customer spends on wine). These algorithms do exist and they fall under the general domain called Machine Learning.

Most machine learning algorithms out there work on the same simple principle: they try to approximate some sort of function that explains the data. In our example, they try to figure out a formula for the blue line. Notice also that the blue line itself does not perfectly fit the training data, meaning that it doesn’t go through all the points. Well, should it? Would you like it to perfectly fit the data, or are you happy with a general and “good enough” solution? That’s something to think out.

How exactly machine learning algorithms work won’t be discussed here. There are too many different algorithms and each one deserves its own post, so we’ll leave it for a future article. Remember though this common ground about these algorithms: all look at the data and try to explain in in some way; this is ultimately some form of learning.

3. More examples of Machine Learning problems

Machine learning can be used to “solve” many problems. Here are some of them.

Recognizing letters and numbers

Figure 4: Optical Character Recognition (OCR)

Getting a loan – if you want to get a loan from the bank, a computer algorithm will tell the bank clerk if you are eligible or not based on all the info they have about you.

Medical diagnosis – based on your symptoms and medical records, a ML algorithm can predict if you suffer from a certain disease or not.

Fraud detection – all banks have automated algorithms that check for transaction frauds.

Spam filtering – have you wondered how some of the emails you receive get into the spam folder? Well, each message you receive is classified as spam or not spam by a ML algorithm.

Face detection – some photo cameras are smart enough to only take a picture when all subjects in it smile. That means that the camera needs to detect faces and smiles using ML algorithms.

Predicting the weather – is it likely to rain tomorrow or not?

Identifying “good” blog posts – although algorithms still cannot understand a piece of text, they can look at external indicators to determine if an article is good or not.


[1] Schapire, R. (2008) COS 511: Theoretical Machine Learning

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: