We believe mastery of a certain machine learning concept/topic is achieved only when the answer to each of the following three questions is affirmative.
Intuition Can you describe the idea with a simple picture?
Mathematical derivation Can you express your intuition in mathematical notation and derive underlying models/cost functions?
Implementation Can you code up your derivations in a programming language, say Python, without using high-level libraries?
Intuition comes first. Intuitive leaps precede intellectual ones, and because of this we have included over 300 color illustrations in the book that have been meticulously designed to enable an intuitive grasp
of technical concepts. Many of those illustrations are snapshots of animations that show convergence of certain algorithms,
evolution of certain models from underfitting all the way to overfitting, etc. This sort of concepts can be illustrated and intuited best using animations (as opposed to static figures).
You'll find a large number of such animations in this repository -- which you can modify yourself too via the raw Jupyter notebook version of these notes. Here are just a few examples:
Cross-validation (regression)
Cross-validation (two-class classification)
Cross-validation (multi-class classification)
K-means clustering
Feature normalization
Normalized gradient descent
Rotation
Convexification
Dogification!
A nonlinear transformation
Weighted classification
The moving average
Batch normalization
Logistic regression
Polynomials vs. NNs vs. Trees (regression)
Polynomials vs. NNs vs. Trees (classification)
Changing gradient descent's steplength (1d)
Changing gradient descent's steplength (2d)
Convex combination of two functions
Taylor series approximation
Feature selection via regularization
Secant planes
Function approximation with a neural network
A regression tree
Mathematical optimization: the workhorse of machine learning. We highly emphasize the importance of mathematical optimization in our treatment of machine learning. Optimization is the workhorse of machine learning
and is fundamental at many levels – from the tuning of individual models to
the general selection of appropriate nonlinearities via cross-validation. Because
of this a strong understanding of mathematical optimization is requisite if one
wishes to deeply understand machine learning, and if one wishes to be able to
implement fundamental algorithms. Part I of the book provides a complete introduction to mathematical optimization, covering zero-, first-, and second-order methods, that are relied upon later in deriving and tuning machine learning models.
Learning by doing. We place significant emphasis on the design and implementation of algorithms throughout the text with implementations of fundamental
algorithms given in Python. These fundamental examples can then be used as
building blocks for the reader to help complete the text’s programming exercises, allowing them to ”get their hands dirty” and ”learn by doing,” practicing
the concepts introduced in the body of the text. While in principle any programming language can be used to complete the text’s coding exercises, we highly
recommend using Python for its ease of use and large support community. We
also recommend using the open-source Python libraries NumPy, autograd, and
matplotlib, as well as the Jupyter notebook editor to make implementing and
testing code easier. A complete set of installation instructions, datasets, as well
as starter notebooks can be found in this repository.
A select number of Chapters/Sections are highlighted below and are linked to HTML notes that served as early drafts for the second edition of the textbook. You can find these html files as well as Jupyter notebooks which created them in the notes subdirectory.
Chapter 1. Introduction to Machine Learning
1.1 Introduction
1.2 Distinguishing Cats from Dogs: a Machine Learning Approach
1.3 The Basic Taxonomy of Machine Learning Problems
1.4 Mathematical Optimization
1.5 Conclusion
14.1 Introduction
14.2 From Stumps to Deep Trees
14.3 Regression Trees
14.4 Classification Trees
14.5 Gradient Boosting
14.6 Random Forests
14.7 Cross-Validation Techniques for Recursively Defined Trees
14.8 Conclusion
14.9 Exercises
Appendix A. Advanced First- and Second-Order Optimization Methods
Appendix B. Derivatives and Automatic Differentiation
B.1 Introduction
B.2 The Derivative
B.3 Derivative Rules for Elementary Functions and Operations
B.4 The Gradient
B.5 The Computation Graph
B.6 The Forward Mode of Automatic Differentiation
B.7 The Reverse Mode of Automatic Differentiation
B.8 Higher-Order Derivatives
B.9 Taylor Series B.10 Using the autograd Library
The second edition of this text is a complete revision of our first endeavor, with
virtually every chapter of the original rewritten from the ground up and eight
new chapters of material added, doubling the size of the first edition. Topics from
the first edition, from expositions on gradient descent to those on One-versusAll classification and Principal Component Analysis have been reworked and
polished. A swath of new topics have been added throughout the text, from
derivative-free optimization to weighted supervised learning, feature selection,
nonlinear feature engineering, boosting-based cross-validation, and more.
While heftier in size, the intent of our original attempt has remained unchanged: to explain machine learning, from first principles to practical implementation, in the simplest possible terms.
Example ”roadmaps” shown below provide suggested paths
for navigating the text based on a variety of learning outcomes and university
courses taught using the present book.
Recommended study roadmap for a course on the essentials of machine learning, including requisite chapters (left column), sections (middle column), and corresponding topics (right column). This essentials plan is suitable for time-constrained courses (in quarter-based programs and universities) or self-study, or where machine learning is not the sole focus but a key component of some broader course of study.
Recommended study roadmap for a full treatment of standard machine learning subjects, including chapters, sections, as well as corresponding topics to cover. This plan entails a more in-depth coverage of machine learning topics compared to the essentials roadmap given above, and is best suited for senior undergraduate/early graduate students in semester-based programs and passionate independent readers.
Recommended study roadmap for a course on mathematical optimization for machine learning and deep learning, including chapters, sections, as well as topics to cover.
Recommended study roadmap for an introductory portion of a course on deep learning, including chapters, sections, as well as topics to cover.
To make full use of the text one needs only a basic understanding of vector algebra (mathematical
functions, vector arithmetic, etc.) and computer programming (for example,
basic proficiency with a dynamically typed language like Python). We provide
complete introductory treatments of other prerequisite topics including linear
algebra, vector calculus, and automatic differentiation in the appendices of the
text.
Instructors may request a copy of this text for examination from the publisher's website. Cambridge University Press can also provide you with the solution manual to both editions of the text.
Here you can find a regularly updated errata sheet for the second edition of the text. Please report any typos, bugs, broken links, etc., in the Issues Section of this repository or by contacting us directly via email (see contact section for more info).
An excellent book that treats the fundamentals of machine learning from basic principles to practical implementation. The book is suitable as a text for senior-level and first-year graduate courses in engineering and computer science. It is well organized and covers basic concepts and algorithms in mathematical optimization methods, linear learning, and nonlinear learning techniques. The book is nicely illustrated in multiple colors and contains numerous examples and coding exercises using Python.
John G. Proakis, University of California, San Diego
Some machine learning books cover only programming aspects, often relying on outdated software tools; some focus exclusively on neural networks; others, solely on theoretical foundations; and yet more books detail advanced topics for the specialist. This fully revised and expanded text provides a broad and accessible introduction to machine learning for engineering and computer science students. The presentation builds on first principles and geometric intuition, while offering real-world examples, commented implementations in Python, and computational exercises. I expect this book to become a key resource for students and researchers.
Osvaldo Simeone, King's College, London
This book is great for getting started in machine learning. It builds up the tools of the trade from first principles, provides lots of examples, and explains one thing at a time at a steady pace. The level of detail and runnable code show what's really going when we run a learning algorithm.
David Duvenaud, University of Toronto
This book covers various essential machine learning methods (e.g., regression, classification, clustering, dimensionality reduction, and deep learning) from a unified mathematical perspective of seeking the optimal model parameters that minimize a cost function. Every method is explained in a comprehensive, intuitive way, and mathematical understanding is aided and enhanced with many geometric illustrations and elegant Python implementations.
Kimiaki Sihrahama, Kindai University, Japan
Books featuring machine learning are many, but those which are simple, intuitive, and yet theoretical are extraordinary 'outliers'. This book is a fantastic and easy way to launch yourself into the exciting world of machine learning, grasp its core concepts, and code them up in Python or Matlab. It was my inspiring guide in preparing my 'Machine Learning Blinks' on my BASIRA YouTube channel for both undergraduate and graduate levels.
Islem Rekik, Director of the Brain And SIgnal Research and Analysis (BASIRA) Laboratory
请发表评论