Machine learning (ML) is a branch of artificial intelligence in which computer systems learn to perform a task from examples instead of following rules written out by a programmer. A learning algorithm is given data, adjusts the internal settings of a model to capture the patterns in that data, and the fitted model is then applied to new cases. The term was coined by the IBM researcher Arthur Samuel in 1959.
The field overlaps heavily with statistics and data science. In finance it is used for credit scoring, fraud detection, the reading of text, the execution of orders and the search for trading signals. Markets are an unusually hard setting for it, because the patterns are weak, the data are limited and the environment changes as participants adapt.
Main types of learning
- Supervised learning. The training data contain both inputs and the correct output for each case, and the model learns to predict the output. Predicting a number, such as next month's return, is called regression. Predicting a category, such as default or no default, is called classification, and the model is a classifier.
- Unsupervised learning. The data have no labelled outputs, and the algorithm looks for structure such as groups or common factors. Clustering is the standard example of unsupervised learning.
- Reinforcement learning. An agent learns by acting, receiving rewards or penalties, and adjusting its behaviour. Reinforcement learning has been applied to order execution and market making.
Common models
The simplest supervised model is linear regression, and many practitioners treat it as the baseline that anything more complex must beat. A decision tree splits the data by a sequence of yes-or-no questions. Trees are combined in large numbers through ensemble learning, in methods such as random forests and gradient boosting, which are among the most used tools for tabular financial data. A support vector machine finds the boundary that best separates two classes. An artificial neural network stacks layers of simple units, and networks with many layers are the subject of deep learning, which powers modern image, speech and language systems.
How a model is built and tested
The usual workflow starts by turning raw data into features, the input variables the model will see, such as past returns, valuation ratios or counts of words in a news story. The data are divided into a training set, used to fit the model, and a test set, held back to measure how well it performs on cases it has not seen. The gap between the two results is the central concern of the field. A model that fits the training data closely but does badly on new data has learned noise, a failure called overfitting. Techniques such as cross-validation, penalties on model complexity and early stopping of training are used to control it.
With financial time series, the split must respect time. Training on data from after the test period lets the model see the future, a form of look-ahead bias, so tests are run in chronological order, typically on a rolling basis.
Uses in finance and trading
- Credit and fraud. Lenders and payment firms use classifiers to score applicants and to flag suspicious transactions. These are the most established applications, with large data sets and clear outcomes.
- Return prediction. Quantitative funds combine many weak signals into forecasts of relative returns across shares, a core activity of quantitative trading.
- Text and alternative data. Natural language processing turns news, filings and transcripts into numerical signals.
- Execution. Models predict short-term liquidity and price impact to schedule large orders.
- Risk and surveillance. Models estimate volatility and correlations, and detect unusual trading patterns.
Difficulties specific to markets
In image recognition, a cat photographed today looks like a cat photographed ten years ago, and millions of labelled examples exist. Markets differ on both counts. The signal in returns is very small compared with the noise, so even a good model is right only slightly more often than chance. The amount of independent data is limited: fifty years of monthly returns is just six hundred observations. And the patterns are unstable, because traders who discover a pattern trade on it and weaken it.
These features make complex models easy to fool. A flexible algorithm tested in many configurations will almost always find something that worked in the past. Results also suffer when the data omit failed companies or include values revised after the fact. Many successful applications therefore use machine learning in a constrained way, with economically motivated features, simple models and strict out-of-sample testing.
Interpretability is a further issue. Regulators and risk managers expect firms to be able to explain why a model made a decision, particularly in lending, where unexplained or biased decisions can breach consumer protection law. Complex models are harder to explain than a scorecard, and a body of techniques has grown up to attribute a model's output to its inputs.