Explainer: Machine learning

Machine learning (ML), and artificial intelligence as a whole, have become a vogue and, for some, an alarming trend in computing. This is strange as one of the earliest major goals in computing has been to improve predictions, something for which we’re accustomed to using statistics and conventional modelling. The distinction between those and machine learning is blurred, yet no one seems worried about the impacts on society of improving weather models and their forecasts.

What’s most distinctive about machine learning is that, instead of humans laying down exactly how predictions should be made using equations and rules, ML provides the computer with the tools to develop and build its own predictive techniques.

Take weather forecasting as an example. Over the last couple of centuries, meteorologists and atmospheric physicists have learned a lot about how our atmosphere and weather work. They’ve progressively built more sophisticated mathematical models into which they load measurements taken around the world, and the model will forecast changes over the coming hours and days.

If that hadn’t worked as well as it has, an ML approach might have been to design a large neural network, load it with several years of observational data, and see what predictions it came up with. The neural network isn’t anything like the forecasting models developed by humans, but provides the tools for the computer to develop its own form of model.

Given the success of numerical weather forecasting, ML would there be up against stiff competition. In other fields such as human vision there has been a vast amount of research but little progress has been made on what appear to be relatively everyday problems, which human brains can solve in a fraction of a second. An example of this is object recognition in images, where vision scientists and computer programmers have worked for many years and still not produced a good algorithm to recognise a human face against a background. Yet, thanks to ML using neural networks, even a humble iPhone can now do that quite reliably, and Ventura goes on to extend the range of objects recognised, and can now identify many for you.

Over the last few decades, different designs of ML have developed. Perhaps the simplest to understand is generally known as supervised learning. In this, the ML system is provided with data from which it’s to learn, and the correct answers. You could use this technique to forecast stock price movements, by giving a neural network a large set of historical prices, and improving its performance in predicting how they change over time. One catch commonly encountered here is the tendency to validate the model against the same data used to train it. Not only is that ‘cheating’, but it can lead to overfitting, where the model becomes highly accurate at forecasting the data used to train it, but fails to predict well with previously unseen data.

Unsupervised learning may sound of more limited value, but for some problems it’s the only potential solution. Analysing data to discover clusters can prove formidably difficult using conventional statistical techniques, but may be amenable to ML using unsupervised learning. Most of us can recognise clusters in simple X-Y scatterplots, but when each datapoint has five variable measurements, we struggle to visualise them. ML can perform very well in such situations, and can suggest one or more ways in which data can be grouped into clusters, that we may or may not find meaningful. That’s another important lesson learned from ML: just because a neural network can ‘see’ something in the data doesn’t mean that effect is meaningful, so we always need to view its results in the context of reality.

There are several Big Problems that ML has been used to tackle, among the most notorious being machine translation of human language. A little experience using translation features in macOS and Google Translate shows that, while machine translation can work quite well on straightforward passages and with certain languages, it still has a long way to go before it can match the skills of a human interpreter. Knowing the limits of ML and not overhyping it is essential.

Apple makes an important distinction between two implementations of ML: on-device and off-device learning. ML performed on-device remains private, in that images and other personal data aren’t sent elsewhere for the learning to be performed. To facilitate that, Apple’s more recent chips include a neural engine, which can perform the calculations used for on-device ML at high speed, without burning up CPU cycles. However, for many problems, off-device learning is required, as the data or learning is too big even for your Mac; for example, considerable off-device learning has been performed to support Visual Look Up’s recognition of paintings, but the information transferred from your Mac is designed so that it doesn’t reveal anything personal, such as which paintings you’re most interested in.

Over the last couple of decades, neural networks have flourished as if they’re the only form of ML. That’s untrue, as there are many other techniques that have been used with varying degrees of success. In the late 1990s, a time when neural networks were in disgrace because their simple perceptron model was proving inadequate, I did some research into genetic programming, which proved successful in developing superior algorithms for some purposes. That’s one of a number of techniques which are based on biological and physical parallels: genetic programming uses the principles of evolution to select the best solution to a problem, but isn’t suitable for real-time applications. In those days, I used to run optimisations on multiple Macs for several days, and even now they’d take minutes or hours.

Since then, neural networks have received a lot of attention and a great deal of research effort. The calculations needed to use them in real-time have been progressively accelerated, and now have hardware support in Apple silicon Macs, in the ANE (Apple Neural Engine), GPU and CPU cores themselves. Our Macs are using ML more, to our advantage, whether you’re adjusting the colour in your photographs or just trying to discover the identity of a flower. There’s even more to come, and none of it is in the least bit spooky or alarming. Isn’t that why we use computers in the first place?