A Visual Guide to the Core Algorithms of Machine Learning, with Diagrams, Math and Python Implementations from Scratch. Understand machine learning the way programmers learn best: see it, derive it, then build it. The book takes you from linear regression to transformers and reinforcement learning, one algorithm at a time. Each algorithm follows the same clear path: a diagram that shows what the algorithm is trying to do, the math derived in small steps with every symbol explained, pseudocode you can translate into any language, a clean, tested Python and NumPy implementation written from scratch, a worked example with real output, and the complexity, common pitfalls and library tool to use in practice.
Inside you will find linear and logistic regression, gradient descent and regularization; metrics, cross-validation and the bias-variance trade-off; k-nearest neighbors, naive Bayes and decision trees; random forests, AdaBoost and gradient boosting (with notes on XGBoost, LightGBM and CatBoost); support vector machines and the kernel trick; k-means, hierarchical clustering, DBSCAN and Gaussian mixtures; PCA, SVD, kernel PCA and t-SNE; neural networks and backpropagation, including a tiny autograd engine; optimizers, dropout, batch normalization and training deep networks; convolutional networks, RNNs, LSTMs, attention and transformers; value iteration, Q-learning and bandits; anomaly detection, recommender systems and machine learning in practice.
With 130 diagrams and figures, 76 tested code listings, more than 120 exercises, an algorithm cheat sheet and a notation guide, this book is a companion to my books on C++ algorithms and dynamic programming. It is for developers, students and anyone who wants to understand what is really happening inside machine learning models.



