podqast
Machine Learning GuideOCDevelAll episodes

MLG 012 Shallow Algos 1

54 min
Next episodeMLG 013 Shallow Algos 255 min
Get its new episodes on Latest. No account

Shallow learning algorithms like k-nearest neighbors, k-means, Apriori, PCA and decision trees solve many problems with far less compute than deep learning. Also covers supervised, unsupervised and reinforcement learning, random forests, gradient boosting and where to learn them.
Links • Notes and resources at ocdevel.com/mlg/12

Shallow learning vs deep learning Shallow learning is every algorithm that isn't a layered neural network. Deep learning (MLG 009) isn't a silver bullet, and a shallow algorithm that fits saves time and compute.
Pedro Domingos's The Master Algorithm (MLG 004) follows the search for one algorithm to replace hundreds. This episode covers five; MLG 013 and MLG 014 cover more.
Supervised, unsupervised and reinforcement learning • Supervised: the data comes labeled, with the answer in the spreadsheet's last column. Classification predicts a class, regression a number.

K-nearest neighbors (KNN) KNN is supervised but doesn't train (instance-based learning): a new point gets the majority label of its k nearest stored rows, or their average for regression. k is the number of neighbors that vote; the classes come from the labels. MLG 032 covers distance metrics.
K-means clustering In k-means you choose k, the number of clusters, and it learns where their centers (centroids) go:

The elbow method and silhouette scores help choose k (MLA 011).
Association rules and the Apriori algorithm Market basket analysis (association rule learning) finds what goes together: marshmallows and graham crackers suggest chocolate. A rule needs support (the items often appear together) and confidence (those baskets usually include chocolate).
Apriori (Agrawal and Srikant, 1994) uses the fact that every subset of a frequent itemset is frequent: it grows itemsets one item at a time from frequent ones and prunes any candidate with an infrequent subset.
Principal component analysis (PCA) PCA reduces many features to a few, as a GPA stands in for grades and attendance. Its principal components are new axes, weighted combinations of the original features ordered by the variance they keep, and you keep the first few. They come from the covariance matrix's eigenvectors, and unlike regression there's no target.
Decision trees A learned flowchart of if-else questions. Training picks the best-splitting question, then repeats on each branch:
lives in the sea? → yes: fish; no: number of legs? → two: human, four: cat
Classification trees predict classes, regression trees numbers. The classic algorithms are CART, ID3, C4.5 and C5.0; scikit-learn uses an optimized CART.
A small tree can show why a loan was denied, and US law (Regulation B, under the Equal Credit Opportunity Act) requires lenders to give, or provide on request, the specific principal reasons for a denial.
Random forests and gradient boosting A single deep tree tends to overfit (MLG 015).

More from Machine Learning Guide