Machine learning is enabling computers to tackle tasks that have, until now, only been carried out by people.
From driving cars to translating speech, machine learning is driving an explosion in the capabilities of artificial intelligence – helping software make sense of the messy and unpredictable real world.
But what exactly is machine learning and what is making the current boom in machine learning possible?
What is machine learning?
At a very high level, machine learning is the process of teaching a computer system how to make accurate predictions when fed data.
Those predictions could be answering whether a piece of fruit in a photo is a banana or an apple, spotting people crossing the road in front of a self-driving car, whether the use of the word book in a sentence relates to a paperback or a hotel reservation, whether an email is spam, or recognizing speech accurately enough to generate captions for a YouTube video.
The key difference from traditional computer software is that a human developer hasn’t written code that instructs the system how to tell the difference between the banana and the apple.
Instead a machine-learning model has been taught how to reliably discriminate between the fruits by being trained on a large amount of data, in this instance likely a huge number of images labelled as containing a banana or an apple.
Data, and lots of it, is the key to making machine learning possible.
What is the difference between AI and machine learning?
Machine learning may have enjoyed enormous success of late, but it is just one method for achieving artificial intelligence.
At the birth of the field of AI in the 1950s, AI was defined as any machine capable of performing a task that would typically require human intelligence.
AI systems will generally demonstrate at least some of the following traits: planning, learning, reasoning, problem solving, knowledge representation, perception, motion, and manipulation and, to a lesser extent, social intelligence and creativity.
Alongside machine learning, there are various other approaches used to build AI systems, including evolutionary computation, where algorithms undergo random mutations and combinations between generations in an attempt to “evolve” optimal solutions, and expert systems, where computers are programmed with rules that allow them to mimic the behavior of a human expert in a specific domain, for example an autopilot system flying a plane.
What are the main types of machine learning?
Machine learning is generally split into two main categories: supervised and unsupervised learning.
What is supervised learning?
This approach basically teaches machines by example.
During training for supervised learning, systems are exposed to large amounts of labelled data, for example images of handwritten figures annotated to indicate which number they correspond to. Given sufficient examples, a supervised-learning system would learn to recognize the clusters of pixels and shapes associated with each number and eventually be able to recognize handwritten numbers, able to reliably distinguish between the numbers 9 and 4 or 6 and 8.
However, training these systems typically requires huge amounts of labelled data, with some systems needing to be exposed to millions of examples to master a task.
As a result, the datasets used to train these systems can be vast, with Google’s Open Images Dataset having about nine million images, its labeled video repository YouTube-8M linking to seven million labeled videos and ImageNet, one of the early databases of this kind, having more than 14 million categorized images. The size of training datasets continues to grow, with Facebook announcing it had compiled 3.5 billion images publicly available on Instagram, using hashtags attached to each image as labels. Using one billion of these photos to train an image-recognition system yielded record levels of accuracy – of 85.4% – on ImageNet’s benchmark.
The laborious process of labeling the datasets used in training is often carried out using crowdworking services, such as Amazon Mechanical Turk, which provides access to a large pool of low-cost labor spread across the globe. For instance, ImageNet was put together over two years by nearly 50,000 people, mainly recruited through Amazon Mechanical Turk. However, Facebook’s approach of using publicly available data to train systems could provide an alternative way of training systems using billion-strong datasets without the overhead of manual labeling.
What is unsupervised learning?
In contrast, unsupervised learning tasks algorithms with identifying patterns in data, trying to spot similarities that split that data into categories.
An example might be Airbnb clustering together houses available to rent by neighborhood, or Google News grouping together stories on similar topics each day.
Unsupervised learning algorithms aren’t designed to single out specific types of data, they simply look for data that can be grouped by similarities, or for anomalies that stand out.
What is semi-supervised learning?
The importance of huge sets of labelled data for training machine-learning systems may diminish over time, due to the rise of semi-supervised learning.
As the name suggests, the approach mixes supervised and unsupervised learning. The technique relies upon using a small amount of labelled data and a large amount of unlabelled data to train systems. The labelled data is used to partially train a machine-learning model, and then that partially trained model is used to label the unlabelled data, a process called pseudo-labelling. The model is then trained on the resulting mix of the labelled and pseudo-labelled data.
The viability of semi-supervised learning has been boosted recently by Generative Adversarial Networks (GANs), machine-learning systems that can use labelled data to generate completely new data, which in turn can be used to help train a machine-learning model.
Were semi-supervised learning to become as effective as supervised learning, then access to huge amounts of computing power may end up being more important for successfully training machine-learning systems than access to large, labelled datasets.
What is reinforcement learning?
A way to understand reinforcement learning is to think about how someone might learn to play an old-school computer game for the first time, when they aren’t familiar with the rules or how to control the game. While they may be a complete novice, eventually, by looking at the relationship between the buttons they press, what happens on screen and their in-game score, their performance will get better and better.
An example of reinforcement learning is Google DeepMind’s Deep Q-network, which has beaten humans in a wide range of vintage video games. The system is fed pixels from each game and determines various information about the state of the game, such as the distance between objects on screen. It then considers how the state of the game and the actions it performs in game relate to the score it achieves.
Over the process of many cycles of playing the game, eventually the system builds a model of which actions will maximize the score in which circumstance, for instance, in the case of the video game Breakout, where the paddle should be moved to in order to intercept the ball.
How does supervised machine learning work?
Everything begins with training a machine-learning model, a mathematical function capable of repeatedly modifying how it operates until it can make accurate predictions when given fresh data.
Before training begins, you first have to choose which data to gather and decide which features of the data are important.
A hugely simplified example of what data features are is given in this explainer by Google, where a machine-learning model is trained to recognize the difference between beer and wine, based on two features, the drinks’ color and their alcoholic volume (ABV).
Each drink is labelled as a beer or a wine, and then the relevant data is collected, using a spectrometer to measure their color and a hydrometer to measure their alcohol content.
An important point to note is that the data has to be balanced, in this instance to have a roughly equal number of examples of beer and wine.
The gathered data is then split, into a larger proportion for training, say about 70%, and a smaller proportion for evaluation, say the remaining 30%. This evaluation data allows the trained model to be tested, to see how well it is likely to perform on real-world data.
Before training gets underway there will generally also be a data-preparation step, during which processes such as deduplication, normalization and error correction will be carried out.
The next step will be choosing an appropriate machine-learning model from the wide variety available. Each have strengths and weaknesses depending on the type of data, for example some are suited to handling images, some to text, and some to purely numerical data.
Predictions made using supervised learning are split into two main types, classification, where the model is labelling data as predefined classes, for example identifying emails as spam or not spam, and regression, where the model is predicting some continuous value, such as house prices.
How does supervised machine-learning training work?
Basically, the training process involves the machine-learning model automatically tweaking how it functions until it can make accurate predictions from data, in the Google example, correctly labeling a drink as beer or wine when the model is given a drink’s color and ABV.
A good way to explain the training process is to consider an example using a simple machine-learning model, known as linear regression with gradient descent.
Imagine taking past data showing ice cream sales and outside temperature, and plotting that data against each other on a scatter graph – basically creating a scattering of discrete points.
To predict how many ice creams will be sold in future based on the outdoor temperature, you can draw a line that passes through the middle of all these points, similar to the illustration below.
Once this is done, ice cream sales can be predicted at any temperature by finding the point at which the line passes through a particular temperature and reading off the corresponding sales at that point.
Bringing it back to training a machine-learning model, in this instance training a linear regression model would involve adjusting the vertical position and slope of the line until it lies in the middle of all of the points on the scatter graph.
At each step of the training process, the vertical distance of each of these points from the line is measured. If a change in slope or position of the line results in the distance to these points increasing, then the slope or position of the line is changed in the opposite direction, and a new measurement is taken.
In this way, via many tiny adjustments to the slope and the position of the line, the line will keep moving until it eventually settles in a position which is a good fit for the distribution of all these points. Once this training process is complete, the line can be used to make accurate predictions for how temperature will affect ice cream sales, and the machine-learning model can be said to have been trained.
While training for more complex machine-learning models such as neural networks differs in several respects, it is similar in that it can also use a gradient descent approach, where the value of “weights”, variables that are combined with the input data to generate output values, are repeatedly tweaked until the output values produced by the model are as close as possible to what is desired.
How do you evaluate machine-learning models?
Once training of the model is complete, the model is evaluated using the remaining data that wasn’t used during training, helping to gauge its real-world performance.
When training a machine-learning model, typically about 60% of a dataset is used for training. A further 20% of the data is used to validate the predictions made by the model and adjust additional parameters that optimize the model’s output. This fine tuning is designed to boost the accuracy of the model’s prediction when presented with new data.
For example, one of those parameters whose value is adjusted during this validation process might be related to a process called regularisation. Regularisation adjusts the output of the model so the relative importance of the training data in deciding the model’s output is reduced. Doing so helps reduce overfitting, a problem that can arise when training a model. Overfitting occurs when the model produces highly accurate predictions when fed its original training data but is unable to get close to that level of accuracy when presented with new data, limiting its real-world use. This problem is due to the model having been trained to make predictions that are too closely tied to patterns in the original training data, limiting the model’s ability to generalise its predictions to new data. A converse problem is underfitting, where the machine-learning model fails to adequately capture patterns found within the training data, limiting its accuracy in general.
The final 20% of the dataset is then used to test the output of the trained and tuned model, to check the model’s predictions remain accurate when presented with new data.
Why is domain knowledge important?
Another important decision when training a machine-learning model is which data to train the model on. For example, if you were trying to build a model to predict whether a piece of fruit was rotten you would need more information than simply how long it had been since the fruit was picked. You’d also benefit from knowing data related to changes in the color of that fruit as it rots and the temperature the fruit had been stored at. Knowing which data is important to making accurate predictions is crucial. That’s why domain experts are often used when gathering training data, as these experts will understand the type of data needed to make sound predictions.
What are neural networks and how are they trained?
A very important group of algorithms for both supervised and unsupervised machine learning are neural networks. These underlie much of machine learning, and while simple models like linear regression used can be used to make predictions based on a small number of data features, as in the Google example with beer and wine, neural networks are useful when dealing with large sets of data with many features.
Neural networks, whose structure is loosely inspired by that of the brain, are interconnected layers of algorithms, called neurons, which feed data into each other, with the output of the preceding layer being the input of the subsequent layer.
Each layer can be thought of as recognizing different features of the overall data. For instance, consider the example of using machine learning to recognize handwritten numbers between 0 and 9. The first layer in the neural network might measure the intensity of the individual pixels in the image, the second layer could spot shapes, such as lines and curves, and the final layer might classify that handwritten figure as a number between 0 and 9.
The network learns how to recognize the pixels that form the shape of the numbers during the training process, by gradually tweaking the importance of data as it flows between the layers of the network. This is possible due to each link between layers having an attached weight, whose value can be increased or decreased to alter that link’s significance. At the end of each training cycle the system will examine whether the neural network’s final output is getting closer or further away from what is desired – for instance, is the network getting better or worse at identifying a handwritten number 6. To close the gap between between the actual output and desired output, the system will then work backwards through the neural network, altering the weights attached to all of these links between layers, as well as an associated value called bias. This process is called back-propagation.
Eventually this process will settle on values for these weights and the bias that will allow the network to reliably perform a given task, such as recognizing handwritten numbers, and the network can be said to have “learned” how to carry out a specific task.
What is deep learning and what are deep neural networks?
A subset of machine learning is deep learning, where neural networks are expanded into sprawling networks with a large number of layers containing many units that are trained using massive amounts of data. It is these deep neural networks that have fuelled the current leap forward in the ability of computers to carry out task like speech recognition and computer vision.
There are various types of neural networks, with different strengths and weaknesses. Recurrent neural networks are a type of neural net particularly well suited to language processing and speech recognition, while convolutional neural networks are more commonly used in image recognition. The design of neural networks is also evolving, with researchers recently devising a more efficient design for an effective type of deep neural network called long short-term memory or LSTM, allowing it to operate fast enough to be used in on-demand systems like Google Translate.
The AI technique of evolutionary algorithms is even being used to optimize neural networks, thanks to a process called neuroevolution. The approach was showcased by Uber AI Labs, which released papers on using genetic algorithms to train deep neural networks for reinforcement learning problems.
Is machine learning carried out solely using neural networks?
Not at all. There are an array of mathematical models that can be used to train a system to make predictions.
A simple model is logistic regression, which despite the name is typically used to classify data, for example spam vs not spam. Logistic regression is straightforward to implement and train when carrying out simple binary classification, and can be extended to label more than two classes.
Another common model type are Support Vector Machines (SVMs), which are widely used to classify data and make predictions via regression. SVMs can separate data into classes, even if the plotted data is jumbled together in such a way that it appears difficult to pull apart into distinct classes. To achieve this, SVMs perform a mathematical operation called the kernel trick, which maps data points to new values, such that they can be cleanly separated into classes.
The choice of which machine-learning model to use is typically based on many factors, such as the size and the number of features in the dataset, with each model having pros and cons.
Why is machine learning so successful?
While machine learning is not a new technique, interest in the field has exploded in recent years.
This resurgence follows a series of breakthroughs, with deep learning setting new records for accuracy in areas such as speech and language recognition, and computer vision.
What’s made these successes possible are primarily two factors; one is the vast quantities of images, speech, video and text available to train machine-learning systems.
But even more important has been the advent of vast amounts of parallel-processing power, courtesy of modern graphics processing units (GPUs), which can be clustered together to form machine-learning powerhouses.
Today anyone with an internet connection can use these clusters to train machine-learning models, via cloud services provided by firms like Amazon, Google and Microsoft.
As the use of machine learning has taken off, so companies are now creating specialized hardware tailored to running and training machine-learning models. An example of one of these custom chips is Google’s Tensor Processing Unit (TPU), which accelerates the rate at which machine-learning models built using Google’s TensorFlow software library can infer information from data, as well as the rate at which these models can be trained.
These chips are not just used to train models for Google DeepMind and Google Brain, but also the models that underpin Google Translate and the image recognition in Google Photo, as well as services that allow the public to build machine learning models using Google’s TensorFlow Research Cloud. The third generation of these chips was unveiled at Google’s I/O conference in May 2018, and have since been packaged into machine-learning powerhouses called pods that can carry out more than one hundred thousand trillion floating-point operations per second (100 petaflops).
In 2020, Google said its fourth-generation TPUs were 2.7 times faster than previous gen TPUs in MLPerf, a benchmark which measures how fast a system can carry out inference using a trained ML model. These ongoing TPU upgrades have allowed Google to improve its services built on top of machine-learning models, for instance halving the time taken to train models used in Google Translate.
As hardware becomes increasingly specialized and machine-learning software frameworks are refined, it’s becoming increasingly common for ML tasks to be carried out on consumer-grade phones and computers, rather than in cloud datacenters. In the summer of 2018, Google took a step towards offering the same quality of automated translation on phones that are offline as is available online, by rolling out local neural machine translation for 59 languages to the Google Translate app for iOS and Android.
What is AlphaGo?
Perhaps the most famous demonstration of the efficacy of machine-learning systems is the 2016 triumph of the Google DeepMind AlphaGo AI over a human grandmaster in Go, a feat that wasn’t expected until 2026. Go is an ancient Chinese game whose complexity bamboozled computers for decades. Go has about 200 possible moves per turn, compared to about 20 in Chess. Over the course of a game of Go, there are so many possible moves that searching through each of them in advance to identify the best play is too costly from a computational standpoint. Instead, AlphaGo was trained how to play the game by taking moves played by human experts in 30 million Go games and feeding them into deep-learning neural networks.
Training the deep-learning networks needed can take a very long time, requiring vast amounts of data to be ingested and iterated over as the system gradually refines its model in order to achieve the best outcome.
However, more recently Google refined the training process with AlphaGo Zero, a system that played “completely random” games against itself, and then learnt from the results. At the Neural Information Processing Systems (NIPS) conference in 2017, Google DeepMind CEO Demis Hassabis revealed AlphaZero, a generalized version of AlphaGo Zero, had also mastered the games of chess and shogi.
DeepMind continue to break new ground in the field of machine learning. In July 2018, DeepMind reported that its AI agents had taught themselves how to play the 1999 multiplayer 3D first-person shooter Quake III Arena, well enough to beat teams of human players. These agents learned how to play the game using no more information than available to the human players, with their only input being the pixels on the screen as they tried out random actions in game, and feedback on their performance during each game.
DeepMind researchers say these general capabilities will be important if AI research is to tackle more complex real-world domains.
The most impressive application of DeepMind’s research came in late 2020, when it revealed AlphaFold 2, a system whose capabilities have been heralded as a landmark breakthrough for medical science.
AlphaFold 2 is an attention-based neural network that has the potential to significantly increase the pace of drug development and disease modelling. The system can map the 3D structure of proteins simply by analysing their building blocks, known as amino acids. In the Critical Assessment of protein Structure Prediction contest, AlphaFold 2 was able to determine the 3D structure of a protein with an accuracy rivalling crystallography, the gold standard for convincingly modelling proteins. However, while it takes months for crystallography to return results, AlphaFold 2 can accurately model protein structures in hours.
What is machine learning used for?
Machine learning systems are used all around us and today are a cornerstone of the modern internet.
Machine-learning systems are used to recommend which product you might want to buy next on Amazon or which video you might want to watch on Netflix.
Every Google search uses multiple machine-learning systems, to understand the language in your query through to personalizing your results, so fishing enthusiasts searching for “bass” aren’t inundated with results about guitars. Similarly Gmail’s spam and phishing-recognition systems use machine-learning trained models to keep your inbox clear of rogue messages.
One of the most obvious demonstrations of the power of machine learning are virtual assistants, such as Apple’s Siri, Amazon’s Alexa, the Google Assistant, and Microsoft Cortana.
Each relies heavily on machine learning to support their voice recognition and ability to understand natural language, as well as needing an immense corpus to draw upon to answer queries.
But beyond these very visible manifestations of machine learning, systems are starting to find a use in just about every industry. These exploitations include: computer vision for driverless cars, drones and delivery robots; speech and language recognition and synthesis for chatbots and service robots; facial recognition for surveillance in countries like China; helping radiologists to pick out tumors in x-rays, aiding researchers in spotting genetic sequences related to diseases and identifying molecules that could lead to more effective drugs in healthcare; allowing for predictive maintenance on infrastructure by analyzing IoT sensor data; underpinning the computer vision that makes the cashierless Amazon Go supermarket possible, offering reasonably accurate transcription and translation of speech for business meetings – the list goes on and on.
In 2020, OpenAI’s GPT-3 (Generative Pre-trained Transformer 3) made headlines for its ability to write like a human, about almost any topic you could think of.
GPT-3 is a neural network trained on billions of English language articles available on the open web and can generate articles and answers in response to text prompts. While at first glance it was often hard to distinguish between text generated by GPT-3 and a human, on closer inspection the system’s offerings didn’t always stand up to scrutiny.
Are machine-learning systems objective?
As you’d expect, the choice and breadth of data used to train systems will influence the tasks they are suited to. There is growing concern over how machine-learning systems codify the human biases and societal inequities reflected in their training data.
For example, in 2016 Rachael Tatman, a National Science Foundation Graduate Research Fellow in the Linguistics Department at the University of Washington, found that Google’s speech-recognition system performed better for male voices than female ones when auto-captioning a sample of YouTube videos, a result she ascribed to ‘unbalanced training sets’ with a preponderance of male speakers.
Facial recognition systems have been shown to have greater difficultly correctly identifying women and people with darker skin. Questions about the ethics of using such intrusive and potentially biased systems for policing led to major tech companies temporarily halting sales of facial recognition systems to law enforcement.
As machine-learning systems move into new areas, such as aiding medical diagnosis, the possibility of systems being skewed towards offering a better service or fairer treatment to particular groups of people is becoming more of a concern. Today research is ongoing into ways to offset bias in self-learning systems.
What about the environmental impact of machine learning?
The environmental impact of powering and cooling compute farms used to train and run machine-learning models was the subject of a paper by the World Economic Forum in 2018. One 2019 estimate was that the power required by machine-learning systems is doubling every 3.4 months.
As the size of models and the datasets used to train them grow, for example the recently released language prediction model GPT-3 is a sprawling neural network with some 175 billion parameters, so does concern over ML’s carbon footprint.
There are various factors to consider, training models requires vastly more energy than running them after training, but the cost of running trained models is also growing as demands for ML-powered services builds. There is also the counter argument that the predictive capabilities of machine learning could potentially have a significant positive impact in a number of key areas, from the environment to healthcare, as demonstrated by Google DeepMind’s AlphaFold 2.
Which are the best machine-learning courses?
A widely recommended course for beginners to teach themselves the fundamentals of machine learning is this free Stanford University and Coursera lecture series by AI expert and Google Brain founder Andrew Ng.
More recently Ng has released his Deep Learning Specialization course, which focuses on a broader range of machine-learning topics and uses, as well as different neural network architectures.
If you prefer to learn via a top-down approach, where you start by running trained machine-learning models and delve into their inner workings later, then fast.ai’s Practical Deep Learning for Coders is recommended, preferably for developers with a year’s Python experience according to fast.ai. Both courses have their strengths, with Ng’s course providing an overview of the theoretical underpinnings of machine learning, while fast.ai’s offering is centred around Python, a language widely used by machine-learning engineers and data scientists.
Another highly rated free online course, praised for both the breadth of its coverage and the quality of its teaching, is this EdX and Columbia University introduction to machine learning, although students do mention it requires a solid knowledge of math up to university level.
How do I get started with machine learning?
Technologies designed to allow developers to teach themselves about machine learning are increasingly common, from AWS’ deep-learning enabled camera DeepLens to Google’s Raspberry Pi-powered AIY kits.
Which services are available for machine learning?
All of the major cloud platforms – Amazon Web Services, Microsoft Azure and Google Cloud Platform – provide access to the hardware needed to train and run machine-learning models, with Google letting Cloud Platform users test out its Tensor Processing Units – custom chips whose design is optimized for training and running machine-learning models.
This cloud-based infrastructure includes the data stores needed to hold the vast amounts of training data, services to prepare that data for analysis, and visualization tools to display the results clearly.
Newer services even streamline the creation of custom machine-learning models, with Google offering a service that automates the creation of AI models, called Cloud AutoML. This drag-and-drop service builds custom image-recognition models and requires the user to have no machine-learning expertise, similar to Microsoft’s Azure Machine Learning Studio. In a similar vein, Amazon has its own AWS services designed to accelerate the process of training machine-learning models.
Database admins without a background in data science can use Google’s BigQueryML, a beta service that allows admins to call trained machine-learning models using SQL commands, allowing predictions to be made in database, which is simpler than exporting data to a separate machine learning and analytics environment.
For firms that don’t want to build their own machine-learning models, the cloud platforms also offer AI-powered, on-demand services – such as voice, vision, and language recognition.
Meanwhile IBM, alongside its more general on-demand offerings, is also attempting to sell sector-specific AI services aimed at everything from healthcare to retail, grouping these offerings together under its IBM Watson umbrella.
Early in 2018, Google expanded its machine-learning driven services to the world of advertising, releasing a suite of tools for making more effective ads, both digital and physical.
While Apple doesn’t enjoy the same reputation for cutting-edge speech recognition, natural language processing and computer vision as Google and Amazon, it is investing in improving its AI services, with Google’s former chief of machine learning in charge of AI strategy across Apple, including the development of its assistant Siri and its on-demand machine learning service Core ML.
In September 2018, NVIDIA launched a combined hardware and software platform designed to be installed in datacenters that can accelerate the rate at which trained machine-learning models can carry out voice, video and image recognition, as well as other ML-related services.
The NVIDIA TensorRT Hyperscale Inference Platform uses NVIDIA Tesla T4 GPUs, which delivers up to 40x the performance of CPUs when using machine-learning models to make inferences from data, and the TensorRT software platform, which is designed to optimize the performance of trained neural networks.
Which software libraries are available for getting started with machine learning?
There are a wide variety of software frameworks for getting started with training and running machine-learning models, typically for the programming languages Python, R, C++, Java and MATLAB, with Python and R being the most widely used in the field.