What is Machine Learning?
Machine learning is a field of artificial intelligence (AI) directed by algorithms that are capable of “learning” the patterns of the training data and then accurately inferring patterns from new data. This pattern recognition capability allows machine learning models to make decisions or predictions without the need for explicit and hard-coded instructions.
The field of AI has been taken over by machine learning: it is the basis of most contemporary AI solutions, including forecasting models, autonomous vehicles, large language models (LLMs), and other generative AI tools.
Machine learning (ML) is based on these two concepts: When a model is trained using data from tasks with similar characteristics to the actual tasks it will be applied to (a process called model training), it can make accurate predictions on new data that is encountered in the final application.
Training is just the means, the end is generalization, the ability to get good performance on the training set and to useful results in real world situations. The deployment of an AI model is called AI inference, as it involves a trained model making inferences based on patterns it learned during training, for a real-world task.
Over the last few decades, deep learning, one of the branches of machine learning using large (or “deep”) artificial neural networks, has become the new model architecture when it comes to almost any field that uses the power of AI. Unlike the algorithms defined in standard machine learning, deep learning is based on spread-out “networks” of mathematical operations that have an unprecedented level of capacity for learning the complexities of extremely complex data sets. When deep learning was first created, it had become more crucial than ever before for “big data” and graphics processing units (GPUs).
Machine learning is heavily linked with the discipline of data science. From a certain perspective, machine learning is a set of algorithms and techniques for automating data analysis and (more significantly) deriving lessons from such analysis and using that information to drive the automatic execution of relevant tasks.
In 1959, Arthur L. Samuel wrote an article in the IBM Journal, “Some Studies in Machine Learning Using the Game of Checkers,” which is believed to be the term’s origin. In the introduction to the paper, Samuel succinctly states the desired end goal of machine learning: “A computer should be able to be programmed so that it will learn to play a better game of checkers than can be played by the person who wrote the program.1
Machine Learning vs. Artificial Intelligence
Though “machine learning” and “artificial intelligence” are often used interchangeably, they are not quite synonymous. To sum up: Machine Learning is a form of AI, but AI is not machine learning.
The popular perception of AI is often science fiction, such as HAL 9000, like in 2001 A Space Odyssey, or Ava, like in Ex Machina, and, most recently, with generative AI. However, the word “artificial intelligence” is used for anything that uses information to make decisions or predictions without human involvement.
The most basic of AI systems are a set of if-then-else conditions, where the rules and logic are manually written by a data scientist. At the basic level, the simplest thermostat is a rules-based AI system: if it is programmed with some basic rules such as:The simplest thermostat is the simplest rules-based AI system:
The thermostat can make its own decision without any other human intervention. On a more complex level, a large and complex rules-based decision tree programmed by medical experts might be able to process symptoms, circumstances and comorbidities to assist with diagnosis or prognosis.2
In the case of expert systems, the reasoning used by the machine learning model is not explicitly programmed, but rather it is learned from experience. In regard to filtering e-mail spam, a program that operates within a rules-based AI model requires a data scientist to design accurate universal spam rules, while a program based on machine learning only requires its own choice of algorithm and good representative samples of e-mail. During training, the model is presented with sample emails and it is trained to predict whether they are spam or not, the error from the predictions is calculated and the algorithm is modified to decrease the error; this continues until the model is accurate. The newly trained ML model has indirectly acquired the skill to detect spam.
The more complex the tasks an AI system is expected to perform the more brittle rules-based models will be; it is often not possible to explicitly define all possible patterns and variables a model needs to consider. Machine learning systems are the most prevalent type of A.I. systems because data contains implicit learning patterns that are inherently more flexible, scalable and accessible.
How Machine Learning Works
Machine learning is based on mathematical logic. The important properties (or “features”) of each data point, then, must be translated into numbers, in order to be input into a mathematical algorithm that will “learn” to associate a specific input with the desired output.
Data points in machine learning are usually represented in vector form, in which each element (or dimension) of a data point’s vector embedding corresponds to its numerical value for a specific feature. In some cases, data may be inherently numerical, like financial data or geospatial data, so it is relatively easy to create such a modality. But many data modalities, such as text, images, social media graph data or app user behaviors, are not inherently numerical, and therefore entail less immediately intuitive feature engineering to be expressed in an ML-ready way.
The (often manual) process of choosing which aspects of data to use in machine learning algorithms is called feature selection. Feature extraction methods are methods that reduce the information to only the most important and informative dimensions. Both are part of a larger field known as feature engineering which is concerned with the pre-processing of raw data for machine learning. A key difference about deep learning is that it generally works with raw data and automates a lot of the feature engineering (or at least feature extraction) process. It is more scalable than traditional machine learning methods, but less interpretable.
Types of machine learning
All machine learning methods can be categorized as one of three distinct learning paradigms: supervised learning, unsupervised learning or reinforcement learning, based on the nature of their training objectives and (often but not always) by the type of training data they entail.
Supervised learning is the process of training a model to forecast the “right” answer to a given input. It is applicable to a wide variety of tasks that involve some degree of accuracy compared to some external “ground truth,” like classification or regression.
Unsupervised learning is a type of model learning that can identify patterns, dependence and correlation within the data without supervision. In contrast to supervised learning, there is no external ground truth with which to compare the results of unsupervised learning tasks.
Reinforcement Learning (RL) is a learning method that involves taking an action and determining if the action will lead to the highest possible reward for the model. RL scenarios do not involve the presence of an absolute “right” or “wrong” (or “approximate”) answer, but do involve the presence of “good” and “bad” (or “neutral”) actions.
A specific model’s end to end training process can, and frequently does, incorporate multiple of these learning paradigms. Unsupervised learning is often used when pre-processing the data for supervised or reinforcement learning, for example. Pre-training and fine-tuning are usually done using supervised learning methods. An additional stage of fine-tuning is typically done with reinforcement learning techniques, like reinforcement learning from human feedback (RLHF).
A different approach, but related, is ensemble learning, which combines the results of several algorithms.
Supervised learning
Supervised learning algorithms develop models for tasks that are accurate, like classification or regression. Supervised machine learning is at the heart of cutting-edge deep learning algorithms and numerous widely-used classical machine learning models that are used in every industry.
The regression models can be used to predict continuous values like price, duration, temperature or size. Examples of traditional regression algorithms include linear regression, polynomial regression and state space models.
Classification models make predictions of a discrete value like the category (or class) a data point falls into, a binary decision, or some action to be taken. Examples of traditional classification algorithms include support vector machines (SVMs), Naïve Bayes and logistic regression.
There are plenty of supervised ML algorithms that can be used for either one. For example, the answer returned by a seemingly regression algorithm can then be used to make a classification prediction.
The results or outputs from a model need to be accurate and therefore measured and optimized against a ground truth – the desired or “correct” output to a given input. In conventional supervised learning, that is the ground truth that is supplied by labeled data. A training set of emails labeled as either SPAM or NOT SPAM is used to train an email spam detection model. A set of images in which each pixel has been classified is used to train an image segmentation model. Supervised learning is about tuning the model parameters so that the model produces the desired output when presented with the ground truth (labels).
A critical component in supervised learning is the definition of a loss function that quantifies the difference between the model’s results and the actual data for a batch of examples that the model is trained on. Supervised learning is formulated mathematically as minimizing the output of a loss function. After this the loss has been computed, different optimization algorithms are used which all require a computation of the derivatives (usually only one derivative) of the loss function to find the parameter changes which will decrease loss.
This process is traditionally performed by a human in the loop who has to provide the ground truth as data annotations so it’s called ‘supervised’ learning. It was therefore historically believed that the ability to use labeled data was the distinguishing trait of supervised learning. However, on the most basic level, supervised learning is characterised by the presence of some ground truth, and the training goal is to minimise the output of some loss function which measures the divergence between the output and the ground truth.
Modern ML parlance conveys a more general idea of supervised learning by using “supervision” or “supervisory signals” for any source of the ground truth.
Self-supervised Learning
For complex tasks and large amounts of data, labelling data can be time-consuming and costly. Self-supervised learning involves learning from tasks in which a supervisory signal is directly derived from unlabeled data – hence the use of the word “self”.
For example, autoencoders learn to compress (or encode) the input data, and then try to reconstruct (or decode) the input data from the compressed representation. Their goal in training is to get rid of the reconstruction error, and they use the original input as their ground truth. The key way in which LLMs are trained is by self-supervised learning: the models are given text snippets with some words removed or masked, and asked to predict those words.
Self-supervised learning is often connected to the concept of transfer learning, where the foundation models can be broadened with a high level of abilities, and then adapted to the task at hand.
Semi-supervised Learning
Whereas self-supervised learning is essentially supervised learning on unlabeled data, semi-supervised learning methods use both labeled data and unlabeled data. In general, semi-supervised learning techniques involve utilizing the information contained in the labeled data set to make assumptions about the unlabeled data set for the purpose that it can be added to a supervised learning process.
Unsupervised learning
Unsupervised machine learning algorithms discern intrinsic patterns in unlabeled data, such as similarities, correlations or potential groupings. They’re most useful in scenarios where such patterns aren’t necessarily apparent to human observers. Unsupervised learning doesn’t assume that there is a known “correct” output, so there is no supervisory signal or traditional loss function, hence “unsupervised.”
Most unsupervised learning techniques fall into one of the following categories:
Clustering algorithms are methods that have been developed to group unlabeled points of data together based on their similarity or closeness. Usually, they are employed on tasks such as market segmentation, fraud detection, etc. Well known clustering algorithms are the Gaussian mixture model (GMMs), density-based algorithms, like DBSCAN, and K-means clustering.
Association algorithms detect relationships, e.g. between a specific action and specific conditions. For example, unsupervised association models are used for powering recommendation engines in e-commerce enterprises like Amazon.
The dimensionality reduction algorithms are aimed at reducing the complexity of data points by representing them with a smaller number of features (fewer dimensions) while retaining its meaningful features. They are typically applied in data pre-processing or to visualize data, among other things. Prominent dimensionality reduction algorithms include autoencoders, principal component analysis (PCA), linear discriminant analysis (LDA) and t-Distributed Stochastic Neighbor Embedding (t-SNE).
Unsupervised learning algorithms, as the names indicate, can be broadly understood as simply ‘optimizing’ themselves without supervision. For instance, this animation shows the iterative optimization, by k-means clustering algorithm, of the centroid of each cluster, independently. In unsupervised learning, the challenge is to not only perform effective data preprocessing, but to also set the value of hyperparameters that already affect how the model learns, but are not learned by it, like the learning rate or the number of clusters.
Reinforcement learning (RL)
Supervised learning is learning from optimization to match ideal exemplars, and unsupervised learning algorithms are built to fit a dataset, while reinforcement learning algorithms learn a model by trial and error. They are heavily leveraged in the field of robotics, video games, reasoning models, and other applications where there is a large number of potential solutions and/or approaches, and the space is open or hard to define. In RL literature, an AI system is often referred to as an “agent.”
In supervised learning, data tuples are composed of an independent pair of input and output data, while in reinforcement learning (RL), the data tuples consist of a tuple of state, action, and reward, where the state is not independent from the action. The goal of reinforcement learning is not to minimize error, but to maximize reward by optimizing its parameters.
A mathematical framework for reinforcement learning is built primarily on the following components:
The state space is a set of all this information that the model may use in the decision making process. State is usually modified for every action of the model.
All the choices the model can make at a moment are stored in the action space. For example, in a game of board games, the action space is the set of all possible moves that can be made at any time. Text generation is a task in which the action space is the full “vocabulary” that an LLM can generate.
Reward signal: reward or punishment (usually a scalar) that is given to the agent after each action. The reward signal can be set by explicit rules, with the reward function, or with a reward model that is trained separately.
In Deep Reinforcement Learning, The Policy is Represented as a Neural Network
Deep Learning
Unlike traditional machine learning, which uses explicit machine learning algorithms, deep learning uses artificial neural networks that have multiple layers, hence, “deep.” Although neural networks had been employed as early as in the beginning of the machine learning era, they gained traction for most subfields of AI only in the late 2000s and early 2010s, with the help of the improvement of GPUs.
The brain-like structure of neural networks consists of a series of “neurons” (or nodes), which are interconnected and each conduct their own mathematical function (also known as an “activation function”). The output of each node’s activation function serves as input to each of the nodes of the following layer and so on until the final layer, where the network’s final output is computed. Most importantly, the activation functions at every node are not linear, which allows for the modelling of complex patterns and dependencies.
Each of the two neurons’ connections is given a unique weight—a gain that strengthens or weakens a neuron in the next layer. The parameters to be optimized using machine learning are these weights, and also unique bias terms added to every neuron’s activation function.
Back propagation algorithm allows computing of contribution of each individual node to the total output of the loss function, and it is possible to individually optimize millions or even billions of model weights using gradient descent algorithms. Deep learning is very different from traditional ML because it requires very large amounts of data and computational resources to produce the best results, and since the amount of updates that need to be made are very large and granular, it is hard to keep up with.
That distributed architecture provides the staggering capabilities and flexibility of deep learning models. Think of “training data” as data points randomly distributed on a 2D graph. The idea of traditional machine learning is to find one curve that passes through all those data points; deep learning constructs a chain of an unlimited number of smaller, individually adjustable curves to create the desired curve. A neural network can represent any function with the following theorem: For any function, there exists an arrangement of neural networks that can represent it.3, 4
With that being said, although it is technically possible, it is not feasible by current training techniques. Adequate performance on some tasks was out of reach even for deep learning models for many years—but over time, some changes to the standard neural network architecture have enabled more capabilities for ML models.
Convolutional Neural Networks (CNNs)
Neural networks with convolutional layers are called convolutional neural networks (CNNs). In mathematics, a convolution is an operation where one function modifies (or convolves) the shape of another. Convolutional layers in CNNs help identify significant features in the data using “filters” that are applied to the data with weights. CNNs are mainly used with computer vision models and with images but there are several other important uses.
Recurrent Neural Network (RNN)
Recurrent neural networks (RNNs) are specialized networks that are used for processing sequential data. In contrast to conventional feedforward neural networks, which take a single input and produce a single output, RNNs take a sequence of inputs and produce an output, operating in a recurrent loop in which the output of a single step in the input sequence becomes input for the next step in the input sequence. This gives RNNs a sense of context and sequence, an internal “memory,” known as the hidden state.
Mamba Models
Mamba models are a recently introduced neural network architecture from 2023 that is based on a novel modification of state space models (SSMs). Mamba models offer a novel way to focus on the most pertinent information at any given time, much like transformers do. Recently, Mamba has come to the fore as an alternative to the transformer architecture, especially for LLMs.
Machine Learning Use Cases
The majority of the applications of machine learning can be classified into one or more of the following application types based mainly on the type of data they use and the type of application they can be used for.
Computer vision
Computer vision is a subdomain of AI that involves the image data and the other modalities of data that need a model or machine to “see”, whether in healthcare diagnostics, facial recognition, or self-driving cars. Notable subfields of computer vision include image classification, object detection, image segmentation and optical character recognition (OCR).
Natural language processing (NLP)
Natural Language Processing (NLP) is a versatile field of study related to text, speech and other language data. Notable subdomains of NLP include chatbots, speech recognition, language translation, sentiment analysis, text generation, summarization and AI agents. Today, large language models are driving the state-of-the-art in NLP to an unprecedented degree.
Time series analysis
Anomaly detection, market analysis and other pattern recognition or prediction problems are solved using time series models. They use machine learning on historical data for a variety of forecasting use cases.
Image generation
Original images created using pixel patterns learned from the training data can be generated by diffusion models, variational autoencoders (VAEs) and generative adversarial networks (GANs).
Machine Learning Operations (MLOps)
Machine learning operations (MLOps) refers to a series of practices to make an assembly line for building, deploying and maintaining machine learning models.
Data curation and preprocessing are very important phases of the MLOps pipeline and having the right model is essential. To ensure that a model is widely applicable and not simply memorizing the training data, careful post-training validation, from the design of benchmark data sets to the importance attached to specific performance metrics, is important.
After deployment, models should be monitored for model drift and issues with inference efficiency and other negative developments. Effective model governance is crucial to ongoing effectiveness, particularly in regulated or rapidly evolving sectors.
Machine Learning Libraries
There are a number of open-source tools, libraries and frameworks available to build, train and test machine learning projects. Such libraries provide a variety of pre-configured modules and abstractions to help modelers build ML-based models and workflows more quickly, but the user will need to master the use of popular programming languages, especially Python.
The top open source libraries used for creating deep learning models are PyTorch, TensorFlow, Keras and the Hugging Face Transformers library.
In the realm of traditional ML, there are also open source machine learning libraries and toolkits like Pandas, Scikit-learn, XGBoost, Matplotlib, SciPy and NumPy, to mention a few.