What is ML?
Deisenroth et al., Mathematics for Machine Learning (CC BY 4.0) · mml-book.github.io
ML is function approximation from data. Supervised learning fits a function from labeled examples. Unsupervised learning discovers structure without labels. Reinforcement learning learns from reward signals. Every ML algorithm is choosing a function from a hypothesis space that best explains the data it has seen.
Train/test split
The most basic discipline in ML: never evaluate on the data you trained on. Hold out a portion for testing. The training set teaches; the test set judges.
Nearest-neighbor classifier
The simplest possible classifier: given a new point, find the closest training point and copy its label. No parameters to learn. The training data is the model.
Evaluating accuracy
Accuracy is the fraction of test examples the model gets right. It is the most basic metric — good enough to start, too coarse for serious work. Function approximation alone is not
intelligence; that requires closed feedback loops where the system consolidates what it has learned back into its own processing.
Notation reference
| Math | Scheme | Python | Meaning |
|---|---|---|---|
| f: X → Y | (define (f x) ...) | def f(x): ... | Function mapping |
| (xᵢ, yᵢ) | (list xi yi) | (xi, yi) | Labeled example |
| ‖x - y‖ | (dist x y) | dist(x, y) | Euclidean distance |
| argmin | (find-best ...) | min(..., key=...) | Index of minimum |
| accuracy | (/ correct n) | correct / n | Fraction correct |
Translation notes
Nearest-neighbor is pure functional: no mutation, no learned parameters. The training data is passed as an argument, making the model explicit. Python's min with a key function is the imperative equivalent of the recursive find-best. Both are linear scans — O(n) per query.
Real ML frameworks (scikit-learn, PyTorch) add indexing structures for speed, but the core idea is identical: find the function that best explains the data.
Neighbors
- ๐ช SICP Ch.1 — expressions as data: the foundation for representing training examples
- ๐ฒ Grinstead Ch.1 — sample spaces: the probabilistic framing behind every ML model
- ๐ Statistics Ch.1 — statistics and ML share the same core problem: inferring patterns from data
- ๐ฐ Probability Ch.1 — the probabilistic framing underlying most ML models
- ๐ Linear Algebra Ch.1 — the mathematical backbone of most ML algorithms