How do machines learn?

By Stuart Hewitson

Machine Learning

Our Head of Data Science - Stuart Hewitson - leads us through the fundamental principles of how machines learn, and how this can be applied in the healthcare setting.

Fundamentally all the devices that we deal with are stupid and must be told in explicit detail what to do. Even worse, they normally forget what they were doing if you turn them off or reboot them.

Any electronic device that you work with, from a washing machine to your mobile phone and laptop computer, is controlled by instructions. These instructions are grouped together into algorithms that the computer can execute to achieve a purpose and are presented to you as some form of application or programme.

For a human, and some of the more intelligent animal species, learning is a natural phenomenon. Some things we pick up very easily, others take time and lots of skills take much practise. If you want to become a competent baker you will follow a recipe. You may need to follow that recipe a few times before you remember the ingredients and how to mix and bake them, but if you work with the recipe enough then, after a while, you will not need to refer to it each time you bake.  Traditional programming is the recipe that tells the computer what to ‘bake’, but the computer forgets what to do as soon as it finishes the recipe. So every time the computer needs to perform a task it needs to read the recipe for that task and execute the instructions step-by-step.

Computers get faster every year and can handle more instructions more efficiently, so why do we even need to ‘teach’ them what to do?  First, there are tasks that are highly complex to describe; not impossible, but extremely difficult to describe in an efficient way to the computer. For example, for a computer to distinguish between a dog and a cat from the instructions it is given, you must first define what fur is.

Second, there are rules and patterns that we, as humans, have not been able to articulate yet. Even when we have, they often come into the highly complex category and we may not be able to efficiently instruct the computer to solve them in efficient ways. For example there are millions of combinations of moves in chess that would require every single possible game to be recorded and each optimal strategy identified to programme a computer to beat a world champion. The time taken to sort through all possible combinations would be significant and would require too much time for the game to run smoothly.

So, computer scientists have instead focused on having computers ‘learn’. This is not in the same way as in the recipe example above, where we learn by repeatedly following sets of instructions. No matter how many times we give the computer the same set of instructions it does not ‘learn’ them (this is not strictly true as there are forms of machine learning that allow for knowledge representation. Expert Systems can also be argued as allowing for the capture of knowledge directly that the machines can then use, but this will be covered in a future post).

Where computers do learn they use data. They look for patterns in that data that can then be stored and retrieved in the future so that when they see something similar or combine future measurements together they can identify the closest pattern and ‘infer’ from that pattern. The most common way to do this is to use supervised machine learning techniques. With these techniques the machine that is learning is presented with many examples, each of which has a label, as it works out the patterns in the underlying data, with the goal being to output the correct answer. As we already know, the label with supervised learning is then easy to feedback to the machine how right or wrong it is and let it try again.

Supervised learning, and its related techniques, is as applicable to creating simple decision trees, which can be very easily interpreted by a human, as it is to so-called Deep Learning using Neural Networks.

Using supervised learning it is possible to detect who is a good risk for a loan, cancer in mammograms or other images, and to detect Covid-19 from a cough. In these examples the machine is picking up on ‘signals in the noise’ that we often can’t, particularly when presented with extremely large volumes of data.

Machines do not get tired or bored, and they can process data faster than we are able. So teaching them to detect patterns that we would otherwise find difficult or even impossible makes perfect sense. Add in the possibility of saving lives and improving the quality of life for millions of people through better and more efficient healthcare and the promise of machines that learn is great.

As processors get faster and more efficient we can train better models that can run on wearable devices. With 5G data and model outputs that can be streamed in real-time, this can provide an ‘always-on’ picture of a patient’s health. Therefore, maybe it isn’t so much how we train the machine that matters but focusing on the right problems and making sure that we work to develop beneficial models.

This is not to say that machine learning is the answer to everything, and certainly not to say that it should replace clinicians or other experts. The role of the machine remains as a tool, a tool that is highly sophisticated and specialised to enable experts to do their job even better and so to benefit everyone. If a machine can highlight possible anomalies in scans, alert if a patient’s vital signs are worrying, or even detect possible mental health problems then it enables the clinician to focus on where help is most needed.