Algorithms are constantly being quoted in the press, usually for bad reasons. Sometimes they are claimed to be faceless and error prone formulae, as in the case of the algorithm used to predict the A-level results in 2020. At other times they are sinister creations used to make decisions about people’s lives which cannot be challenged, such as with the algorithms used by the US justice system to decide on prison sentences. In a more positive sense, Algorithms are promoted by dating websites as being an effective way to find you the perfect partner. The OkCupid dating site even says ‘we use math to find you dates’.
Whilst algorithms can be used in these rather dubious ways, they also have many very beneficial applications and are the driving force behind much of the modern technology that we rely on every day of our lives.
What is an Algorithm?
An algorithm is simply a mathematical formula, or more correctly, a set of mathematical instructions (often coded as a computer program), that are used to do a task. One example could be using an algorithm to draw a picture given a set of instructions, another might be an algorithm which tells you what is in an image (useful for a robot driving an automatic car).
Algorithms have been around since people realised that mathematics can describe the world that we live in, and that it can make successful predictions about what is going to happen next. Perhaps the first examples of algorithms were the formulae used thousands of years ago by the Chinese to predict the date of the next solar eclipse. (Indeed the calendar is another example of a very successful algorithm used to predict the changes in the seasons, the best time to plant crops etc).
Other good examples of algorithms are the advanced mathematical methods that are used by the Met Office to predict the weather. These work by solving around one billion equations for each weather forecast. As well as being useful in their own right, the results of a weather forecast are used in other algorithms which predict (for example) how much electricity we need in the next week. Algorithms are used in many different applications, from suggesting what product you might like to buy when you shop online, to helping to predict the number of COVID-19 cases in the next few months.
Algorithms can be designed by using our understanding of the process we are trying to describe to create mathematical models which are an approximation to reality. This is how a weather forecast works, or how an aircraft is designed, both of which use models based on physical or biological laws. Similar algorithms are used widely in many branches of engineering, and are guiding us in the fight against COVID-19. They tend to be reliable because they are based on well understood processes and the uncertainty in these can be quantified in advance.
Neural Nets and Machine Learning
Alternatively, an algorithm can be created by fitting a formula with many free parameters to a large set of data. (The structure behind the formula is often called a neural net as it is an attempt to recreate the way that the brain learns). The data is assumed to have a set of inputs and outputs, and if good enough parameters are chosen, then the algorithm will reproduce the observed outputs. As an example, the inputs could be a series of pictures, and the outputs a classification of the picture as a cat or a dog. Once enough input pictures have been fed in, the algorithm should hopefully be able to classify all new pictures correctly as a cat or as a dog. This method of designing an algorithm has become very popular and is often called machine learning. The process of fitting the model to the data is called training.
Machine Learning has been very successful recently, for example in training machines to learn games such as Chess and Go. (A simple example of this would be fitting a straight line to some data, and using this to predict the future behaviour of that system). Such algorithms can be very effective and are widely used in, for example, the retail industry, and increasingly in the justice and medical sectors. However they suffer from the problem that they inherit the assumptions made in the training process and it is difficult to quantify how reliable they will be in advance. An example of this was the algorithm for deciding the A-level results in 2020. This was trained to produce results which were, on average, similar to those of the year before. It failed (and was in many ways unfair) because other issues (such as being an exceptional student in a poor school) were not considered in the training process. The algorithm was described as being mutant, but the problem was its poor design, not the algorithm itself, which had simply performed the job that it was asked to do.
It is very likely that algorithms will be used to make many more decisions in the future. It is therefore essential that mathematicians (including those reading this article) play a big role in the design of these algorithms so that they can clearly explain how they work and how reliable they are, meaning that organisations can be accountable for any decisions which have been made using algorithms. This should keep mathematicians (and by this I mean also statisticians and computer scientists) very busy in the future.
Professor Chris Budd OBE, FIMA, CMath
University of Bath