Common Machine Learning Algorithms
A plain-language guide to decision trees, regression, k-nearest neighbours, k-means and neural networks, and why no single algorithm is best.
Artificial Intelligence · Lesson 5
A plain-language guide to decision trees, regression, k-nearest neighbours, k-means and neural networks, and why no single algorithm is best.
Machine learning can look like a wall of intimidating names, yet most real systems are built from a small set of workhorse algorithms a beginner can grasp without any mathematics. Knowing what each is good at, and what it quietly gives up in return, lets you read a technical proposal, question a vendor's claims, and spot when a team has reached for a complicated tool where a simple one would do. The single most useful idea in the whole field is that there is no universally best method: the right choice depends on your data, your goal, and how much you must explain the answer to a human. That judgement, not the maths, separates people who use machine learning well from those merely dazzled by it.
A decision tree splits data with a chain of yes or no questions — "income above 30,000?", then "employed over two years?" — until it reaches a prediction you can read like a flowchart. Regression is the other classic. Linear regression fits the straight-line relationship between inputs and a number, such as a house price, while logistic regression does the same for a yes or no outcome, producing a probability such as the chance a loan is repaid. Both are transparent: you can see exactly which factors pushed the answer up or down.
K-nearest neighbours predicts by finding the handful of past examples most similar to a new case and letting them vote. K-means clustering is different in kind: no one supplies the right answer, and it simply groups data into clusters of similar items, such as customer segments. This is the divide between supervised learning, which learns from labelled answers, and unsupervised learning, which discovers structure on its own.
Neural networks stack many simple units into layers that learn extraordinarily complex patterns — the technology behind image recognition and language models. Their strength is flexibility; their cost is opacity. A network with millions of internal weights can be nearly impossible to explain, which matters enormously when a decision affects someone's mortgage or medical care. Power and interpretability pull in opposite directions, and more power is not automatically better.
Suppose a bank must decide which loan applications to approve. A neural network might squeeze out slightly higher accuracy, but regulators require the bank to tell a rejected applicant why. A logistic regression or a shallow decision tree gives a clear, defensible reason — "high existing debt, short credit history" — at a tiny cost in raw performance. Here the interpretable model wins, not despite being simpler but because the task demands an explanation. The best algorithm is the one that fits the whole problem, accuracy included but not alone.
Now flip the setting. A photo app must recognise faces to sort thousands of images. A tree of plain rules cannot cope with the messy variation of pixels, lighting, and angle, and no one wants an explanation for each match — they just want it to work. Here the neural network is clearly right and the interpretable model clearly wrong. The same two algorithms swap places purely because the problem changed, which is why "which algorithm is best?" is never answerable in the abstract.
Credit scoring is one of the oldest large-scale uses of machine learning and has long relied on deliberately simple methods. The FICO score, introduced by Fair, Isaac and Company in 1989, is built on regression-style scorecards that weight factors such as payment history and amounts owed. Decades later, even as lenders experiment with more powerful models, transparent regression and tree-based scorecards remain dominant — largely because lending laws in many countries require that applicants be given specific reasons for a decision. A model no one can explain becomes a legal and ethical liability, so the "weaker" algorithm endures because it answers a genuine real-world need.
Given short scenarios — approving loans, segmenting shoppers, recognising handwriting — choose the most fitting algorithm and justify the interpretability-versus-power trade-off behind your pick.
Think Like a Maester: Before asking which algorithm is most powerful, ask what the task actually needs — an accurate guess, an explainable reason, or a hidden pattern. The answer usually chooses the tool for you.
The workhorse algorithms fall along a spectrum from transparent to powerful: decision trees and regression explain themselves clearly, k-nearest neighbours and k-means reason from similarity, and neural networks trade interpretability for the ability to learn very complex patterns. Choosing among them is a judgement about the whole problem — the data available, the goal, and whether a human needs an explanation — not a search for one superior method. Good practice matches the tool to the task, and often the simplest algorithm that does the job well is the right one.
Mark this lesson complete to track your progress.