Machine learning

A summary of what machine learning is and the different approaches used in this field.

The aim of machine learning (ML) is to create systems (for example, algorithms) able to automatically learn the relationship between input data and the classifications or actions you want to happen without being explicitly programmed.

Popular ML problems include:

  • object classification

  • tracking

  • image segmentation

  • audio recognition

  • land-cover classification

And there are many new and exciting problems where ML is starting to be explored, such as:

  • automatic subtitle generation
  • text generation
  • image colourisation
  • natural disaster prediction

You encounter ML when you speak to Alexa or unlock your smartphone using your fingerprint.

ML differs from classical Symbolic artificial intelligence (AI) because the latter requires a human programmed solution.

To help understand the difference, consider 2 robot mice trying to navigate a maze. The first has been programmed using symbolic AI and the second mouse has ML.

The first mouse has a lot of rules that tell it how to explore a maze to find a reward; someone has had to work out these rules. It will do quite well but if it encounters anything that the programmer didn’t think of, like a new type of obstacle, it will get stuck.

The second mouse has to learn for itself and for quite a few runs of the maze it will be completely lost. But given enough runs it will work out the rules for itself although they will not be represented in the mouse’s robot brain as we might imagine rules to be.

At present there are 4 main approaches in this field:

  • Unsupervised learning

  • Supervised learning

  • Semi-supervised learning

  • Reinforcement learning

Unsupervised learning

This is defined as learning solutions (known as models) that are not overseen (or supervised) by data labelled or tagged by someone - that is the machine has not been told what it is to learn. We give more detail on labelling later.

The most popular family of unsupervised learners are clustering algorithms. Clustering is the process of finding groups in your data that are similar to each other is some way.

Different clustering methods will have different groups defined by different sets of similar properties. An example is Google’s unsupervised Image Classifier that learnt how to distinguish between cats and dogs. Unsupervised learning enables us to discover relationships that may be hidden in our data, for example, showing areas where particular activity one day may indicate particular crimes committed on the following day – something that may not have been obvious.

Supervised learning

This refers to the family of approaches in which the learning is overseen by the label examples or the output of the data. The machine is given examples or training data (labelled data) of what we might be interested in, and also examples that are not what we are interested in. The model is then able to learn a function that maps the input of the training data to some output. So say that we want to teach a machine to identify cats in images. We do so by first labelling images of cats in as many images as we reasonably can. These images, along with a lot of other images that the machine is told do not contain cats, are then used to train the machine.

Supervised methods obtain the most accurate results, since they explicitly tell the machine what is, and isn’t, our thing of interest during the learning process. However, they also need the acquisition of labelled data for your dataset, which can be a problem if you require experts to label them or special equipment. In comparison, obtaining unlabelled data for unsupervised learning is relatively easy.

Reinforcement learning

Another alternative is to reframe the problem.

In reinforcement learning, instead of training a model to find a function to link your input data to your label, you will be training an agent, which will make smaller decisions. For each decision, it will receive a reward. The goal then becomes to maximise the cumulative reward for the agent.

Reinforcement learning has been used successfully in playing games where the game provides the ‘environment’ and the high score (or some other way of telling how well you are doing) the ‘reward’.

Classification and regression

Depending on what you are trying to do, you will be dealing with either a classification, or a prediction, or regression problem. In classification, the goal is to identify a distinct class (the type of thing you are interested in, such as cars or cats). Popular classification problems include:

  • object recognition

  • land-use classification

  • image segmentation

On the other hand, if you are trying to predict a continuous value such as temperature, age, risk levels, you will be dealing with regression methods.

Regression

Regression, or more properly regression analysis is a set of statistical processes for estimating the relationships among variables. Regression analysis helps us understand how the value of one variable changes when any one of the other variables is changed, while the other variables are held fixed.

So in a simple example where there are just 2 variables X and Y, we might want to understand how Y varies as we vary X. So for example, you could work out how quickly your dinner will cook (Y) for different oven temperatures (X).

Where there are 3 or more variables we still only vary 1 to see how another varies keeping all the others at fixed values.

Data and ML

The learning process typically has stages:

  • training
  • validating
  • testing

Each stage will serve a different purpose and use different subsets of your data.

Training phase

In this phase you will use a subset of your dataset, referred to as the training set, to learn a model. Think of the training set as the set of examples that you give your ML algorithm to learn from.

In supervised learning, this data will need to be labelled so the machine can learn from the labels. Labelling can take a considerable amount of time and if it is poorly labelled the results will also be poor so it is important to get this right.

Validating phase

In order to gauge how well the training has worked you can expose the model to further data which will optimise the results. One possible problem with training is that the data can be ‘over-fitted’ (become too sensitive to certain aspects of the data) which can lead to poor results.

For example if we want to identify images that contain tanks then it is possible that the training data will lead the model to be sensitive to green things in general. The validation data set can help to correct for this. It can also help to indicate when enough data has been used and no more training is necessary.

Testing phase

In this phase, the model is tested by giving it the test set, a set of unseen samples and seeing how the prediction of your model compares to the actual output you were expecting. The more similar these are, the better your model is at ‘fitting your data’.

One important thing to remember is that it is crucial that you ensure that no instance in your dataset is used at more than one stage - to do so would invalidate the testing phase, a bit like getting the same question in a real exam as you did in the mock. The other thing to appreciate is that this can require a lot of data, usually the more data you have the better although you will get to a point where the returns begin to rapidly diminish. If you don’t have a lot of data then there are some techniques that can be used, usually referred to as ‘low-shot learning’ techniques, but it may be that ML isn’t the best approach.