All cheat sheets
Cheat sheet: choosing a machine learning algorithm
A first guess at what to try. Always compare on the same folds and the same metric.
2Tables of data
- Gradient boosting usually wins.
- A random forest is a robust default.
- A single decision tree is easy to explain but overfits.
Learn more: The main ML algorithms and when to use each
A random forest trains many different trees and lets them vote. The three trees here are a made-up example.
4Nearest neighbours
- No training step: it keeps all points and lets the closest ones vote.
- Slow on big data; scale the columns first.
Learn more: The main ML algorithms and when to use each
k-nearest neighbours with k = 3: find the three closest known points and let them vote. There is no training step.
5Support vector machines
- Widest gap between classes; the setting C decides how many points may sit on the wrong side.
- Needs scaled features; suits small and medium data.
Learn more: The main ML algorithms and when to use each
A support vector machine picks the boundary with the widest gap between the classes; the closest points are the support vectors.
6Naive Bayes
- A score per class: how common the class is times how likely each word is in it.
- Treats words as independent clues: naive, but a fast text baseline.
Learn more: The main ML algorithms and when to use each
7No labels
- k-means to find groups; PCA to compress; anomaly detection to find the odd ones out.
Learn more: Unsupervised learning: groups, compression and anomalies
k-means assigns each point to its nearest centre, moves the centres to the middle of their points, and repeats. The points are made up.