An introduction to the colourful cast of characters¶
Machine learning is rather like a mismatched football squad in Ankh Morpork. You have the by-the-book defenders, which everyone calls supervised learning, doing what they are told with the rigid enthusiasm of a city watchman counting barrels. Then you have the chaotic strikers, unsupervised learning, darting about with no clear plan, occasionally kicking the ball into the river. And there is always that one player who manages to score own goals with remarkable consistency, otherwise known as reinforcement learning on a bad day.
These digital brainboxes power everything from your sat-nav’s questionable directions to the NHS’s attempts at guessing who will next clog up A&E after indulging at the local curry house. Some operate with the discretion of an MI5 agent, such as federated learning, while others gossip like a Wetherspoons regular after one too many pints, like certain transductive models.
Within this motley crew you will find the know-it-all swots, deductive learners, the lazy students scraping by, semi-supervised learners, and the over-efficient types who borrow other people’s homework, transfer learners. Between them, they can identify your cat photos, recommend dreadful television, and occasionally, when motivated, actually detect something important like cancer cells.
Paradigms¶
The following paradigms have some working code in the ml and deep-learning repositories, including notebooks, preprocessing pipelines, and evaluation examples. If you want to get impressions of this in action rather than described in prose, that is where to look.
Supervised learning¶
Supervised learning is like teaching a child with flashcards, except the child is an algorithm and the flashcards are thousands of labelled data points. You show it pictures of cats and dogs, explain which is which, and hope it does not conclude that every four-legged creature is probably a moggy. Its task is to find patterns that map inputs to outputs. Brilliant at memorising, terrible when confronted with novelty, like a Sphynx cat that looks vaguely extraterrestrial.
Business applications include email spam filtering, credit scoring, fraud detection, medical diagnosis, churn prediction, and insurance risk assessment. Essentially any situation where you have historical examples with known outcomes and would like the machine to handle future ones without bothering a human.
In practice, your email spam filter is a classic example. Trained on millions of emails marked “spam” or “not spam,” it learns that words like “free” and “Nigerian prince” are red flags. Occasionally, it gets overzealous and files your boss’s urgent email under junk because it contained the phrase “meet me tomorrow.” Meanwhile the actual spam about dubious pills slips through because the algorithm has decided it is probably a medical newsletter.
There are privacy and security concerns too. If the training data contains sensitive information, a clever attacker could reverse-engineer the model. A health insurance predictor might accidentally reveal that people aged 30 to 40 who buy gluten-free pasta are high-risk. The model can also be poisoned with fake labels, turning a loyal spam filter into a willing accomplice for scam emails.
Unsupervised learning¶
Unsupervised learning is the algorithm equivalent of dumping a pile of puzzle pieces in the middle of the Guildhall and saying, “Sort that out.” No guidance, no labels, just raw data and existential dread. The algorithm clusters similar items, simplifies data, or flags odd outliers. Think of it as a detective trying to solve a crime without knowing there has been a crime, only that something statistically unusual has occurred.
Business applications include customer segmentation, anomaly detection in financial transactions, market basket analysis in retail, and content discovery in recommendation systems. Anywhere you have data but no one has bothered to label it, which is most places.
Netflix uses this to group users into taste clusters, which is why you end up watching true crime at three while your recommendations gently suggest melatonin. Retailers use it for fraud detection, like your card being blocked for a single banana in Spain. Privacy risks abound, especially when rare behaviour patterns reveal sensitive information, such as purchases indicating pregnancy or medical conditions.
Transfer learning¶
Transfer learning is standing on the shoulders of giants, where the giants are algorithms that did the hard work first. A model trained to recognise cats can be repurposed to spot tumours. The knowledge accumulated during one task is applied to a different but related problem, saving considerable time and compute that would otherwise be spent learning that edges exist.
Business applications include medical imaging, manufacturing quality control, document classification, and any domain where labelled training data is scarce but a related pre-trained model is available. Pharmaceutical companies use it to accelerate drug interaction research. Retailers use it to identify defective products on production lines without photographing every possible fault from scratch.
Risks include hidden biases from the pre-trained model arriving uninvited into your new domain, and the possibility of model stealing, whereby someone reverse-engineers your fine-tuned work from its outputs and decides your competitive advantage is now theirs.
Neural network architectures¶
The deep-learning repository covers the main neural network architectures used across supervised and generative tasks. These are the structural choices made once you have decided to use a neural network and must then decide what shape of suffering to inflict on your data.
Feedforward networks are the baseline, used for tabular classification and regression tasks such as customer churn, loan default, and medical risk scoring. Convolutional neural networks excel at image and signal data, powering everything from satellite imagery analysis to quality inspection on factory floors. Recurrent networks and LSTMs handle sequential data, making them the standard approach for demand forecasting, log anomaly detection, and financial time series. Generative adversarial networks produce synthetic data, used in drug discovery, fraud simulation for model training, and creative applications that regularly unsettle people in marketing meetings.
Further paradigms¶
The following paradigms are included because the landscape of machine learning is considerably wider than any single codebase, and an incomplete map is more useful than pretending the territory ends at the edge of what has been built.
Semi-supervised learning¶
Semi-supervised learning is the lazy student of the class. It learns from a few labelled examples and a mountain of unlabelled data. The labelled examples act as stabilisers, while the unlabelled data careens downhill hoping for the best. Google Photos does this when you label a few pictures of Karen and the algorithm tags your golden retriever as Karen. Speech recognition systems employ it too, turning “Call Mum” into “Ball Bomb” from time to time.
Business applications include content moderation, where labelled examples of harmful content are expensive to produce, web page classification, and medical record analysis where annotating records requires a clinician’s time that is not freely available.
Risks include the unlabelled data containing private information and incorrect labels propagating errors. Imagine a semi-supervised hate speech detector that learns from bad examples and subsequently flags all political discourse as toxic.
Reinforcement learning¶
Reinforcement learning is like training a dog with treats, except the dog is a robot and the treats are mathematical rewards. The agent tries actions, receives feedback, and adjusts. Tesla’s Autopilot learns from millions of miles driven, occasionally receiving corrections from human drivers. AlphaGo learned by playing itself millions of times, resembling a sleepless chess prodigy.
Business applications include algorithmic trading, robotic process automation, supply chain optimisation, autonomous vehicle navigation, and personalised pricing. Anywhere a system must make sequential decisions in an environment that responds to those decisions, without someone providing a labelled example of the optimal choice at each step.
RL systems can be manipulated through reward shaping, potentially leading to unsafe behaviour, and can leak data about the environment they inhabit, like your house layout being unintentionally revealed online.
Ensemble learning¶
Ensemble learning is like asking a panel of slightly drunk pundits for their opinion, averaging it, and calling it wisdom. Each model is mediocre alone, but together they are slightly less wrong. The approach encompasses random forests, gradient boosted trees, and various voting and stacking methods.
Business applications include insurance underwriting, clinical decision support, financial risk modelling, and competitive machine learning where squeezing the last fraction of accuracy matters. Netflix recommendations and NHS risk predictions often rely on ensemble methods. Compromise one model with poisoned data and the entire system can go pear-shaped.
Federated learning¶
Federated learning is the Ankh-Morpork neighbourhood watch of algorithms. Your device learns from your behaviour, whispers the lessons to a central server, and everyone pretends this is not creepy. Data allegedly never leaves your device.
Business applications include mobile keyboard prediction, fraud detection across banks that cannot legally share customer data, and healthcare research across hospitals subject to different data protection regimes. The regulatory appeal is obvious. The technical complexity is considerable. The gap between the two is where most projects quietly expire.
Clever attackers can reconstruct sensitive information from model updates. Side channels, metadata, and model poisoning create further risks. Apple’s predictive keyboard and NHS experiments with federated learning demonstrate the balance of decentralised learning and lurking exposure.
Statistical models¶
Inductive learning¶
Inductive learning generalises from examples. A traffic warden tickets one car and concludes all vehicles must be banned. Business applications include credit scoring, insurance risk assessment, and customer lifetime value prediction, all situations where past behaviour is used to draw conclusions about future behaviour, with the confidence of someone who has never encountered an edge case.
Adversarial manipulation of data can fool the system, and sensitive correlations may be revealed without anyone intending to reveal them.
Deductive learning¶
Deductive learning is strict logical reasoning from defined rules. Tax calculation software uses it to follow rules, often failing when reality refuses to comply. Business applications include regulatory compliance checking, rules-based fraud detection, and any domain where auditability matters more than flexibility and the rules are actually written down somewhere.
Privacy risks are low, but biases may be embedded in the rules themselves by whoever wrote them on a Tuesday afternoon.
Transductive learning¶
Transductive learning memorises training data and improvises when new data appears. It is like cheating by writing answers on your hand. Business applications include drug interaction prediction, where new compounds must be compared against a fixed reference set, and small-sample classification problems where generalising to unseen classes is not required.
NHS COVID contact tracing apps once used this to memorise infection patterns, with predictable panics when reality deviated. Privacy risk is high, as the model can leak memorised training data.
Human-in-the-loop models¶
Human-centred reinforcement learning¶
Humans add feedback to reinforcement learning, guiding the system with sighs and corrections. Business applications include large language model alignment, content moderation at scale, and recommendation system fine-tuning where automated metrics fail to capture what users actually want, which turns out to be surprisingly difficult to articulate.
ChatGPT uses this, with thousands of underpaid reviewers teaching it to avoid absurd answers, except for the occasional conspiracy theorist query. Feedback channels can be abused or compromise privacy.
Active learning¶
Active learning is the needy intern of algorithms, constantly asking “is this right?” It reduces human workload by querying only the most uncertain data points for labelling rather than demanding that everything be annotated before it will condescend to learn anything.
Business applications include medical imaging analysis, legal document review, and any domain where labelling is expensive and expert time is the binding constraint. The queries themselves can reveal sensitive information, and blind spots develop in areas that are never questioned, which tends to be exactly where the interesting failures occur.