How It Works

Mathematics for Machine Learning

Learn the key skills and concepts from linear algebra, multivariable calculus, and probability & statistics that you need to know in order to understand and implement core machine learning algorithms. This course will prepare you for a university-level machine learning course that covers topics such as gradient descent, neural networks and backpropagation, support vector machines, extensions of linear regression (e.g. logistic and lasso regression), naive Bayes classifiers, principal component analysis, matrix factorization methods, and Gaussian mixture models.



Sets and Quantifiers

Formal mathematical notation is often used in machine learning textbooks and papers. While formal symbols are relatively simple to learn through direct instruction, their meaning can be difficult to pick up from context clues, causing them to become a source of bewilderment and intimidation if not understood beforehand.

Hyperbolic Functions

Hyperbolic tangent is a common activation function in the context of neural networks.

Determinants, Gaussian Elimination, and Subspace Projection

Many algorithms in machine learning rely on advanced matrix methods that in turn rely on more foundational linear algebra topics. For example, principal component analysis involves finding eigenvalues and eigenvectors, which requires the use of determinants and gaussian elimination (respectively). Likewise, fitting a linear regression model involves using subspace projection to project the desired outputs onto the subspace of outputs that could possibly be generated by the model.

Eigenvalues and Singular Values

Machine learning systems such as recommender systems often utilize latent factor models to identify the most prominent patterns underlying individual records in a data set, sometimes with the additional goal of reducing the complexity of the data by discarding negligible patterns. This is often accomplished using advanced techniques from linear algebra: the eigenvectors of a square matrix represent independent patterns, their eigenvalues represent the prominence of those patterns, and singular values generalize the idea of eigenvalues to rectangular matrices.

Inner Product Spaces

Support vector machines classify data into two classes by drawing the best possible boundary line between the classes. Even when data is not linearly separable, a kernel function can be used to map the data into an inner product space where it becomes linearly separable. This is known as the “kernel trick” and it tends to baffle those who are not familiar with inner product spaces. Knowledge of inner product spaces can also help provide intuition for similarity measures in clustering algorithms (similarity measures are conceptually opposite to inner products).

Multivariable Calculus

Gradient descent, the most popular family of optimization methods in machine learning, involves computing partial derivatives of multivariable functions. Likewise, in order to extend methods from probability and statistics to multivariate distributions (which are used in e.g. Gaussian mixture models), one must integrate multivariable functions. Finally, the concept of a “hyperplane” (which comes up frequently in the context of classification algorithms) can feel nebulous if one is not already familiar with equations of planes in 3D space.

Random Variables and Distributions

To understand the advanced probability topics that appear in machine learning, one must be able to manipulate random variables and distributions. For example, the covariance matrix of multiple random variables is central to principal component analysis because the principal components are themselves the eigenvectors of the covariance matrix. Likewise, uniform and normal distributions are frequently used during parameter initialization – and the multivariate normal distribution is the central figure in the Gaussian mixture model, a popular clustering algorithm.

Conditional Probability and Likelihood Functions

Conditional probability and likelihood functions are central to machine learning models and algorithms such as naive Bayes classifiers and the expectation maximization algorithm (which is commonly used to fit Gaussian mixture models).

Hypothesis Testing and Regression

Many machine learning models (e.g. logistic regression and lasso regression) are extensions of linear regression. Confidence intervals are often used to place bounds on the uncertainty of a model’s predictions or parameters. Models are usually trained on a sample of a population, and hypothesis testing can be used to determine whether there is sufficient evidence to draw a conclusion about the population as a whole.

22 topics
1.1. Sets
1.1.1. Special Sets
1.1.2. Set-Builder Notation
1.1.3. Equivalent Sets
1.1.4. Cardinality of Sets
1.1.5. Subsets
1.1.6. The Complement of a Set
1.1.7. The Difference of Sets
1.1.8. The Cartesian Product
1.1.9. Sets and Functions
1.1.10. Open and Closed Sets in the Plane
1.2. Logical Quantifiers
1.2.1. Statements and Propositions
1.2.2. Universal and Existential Quantifiers
1.2.3. Formal and Informal Language
1.3. Vector Geometry
1.3.1. The Vector Equation of a Line
1.3.2. The Parametric Equations of a Line
1.3.3. Writing the Cartesian Equation of a Line from the Vector Equation
1.3.4. Finding the Vector Equation of a Plane Using the Dot Product
1.3.5. The Cartesian Equation of a Plane
1.3.6. The Parametric Equations of a Plane
1.3.7. The Intersection of Two Planes
1.4. The Hyperbolic Functions
1.4.1. The Hyperbolic Functions
1.4.2. Graphs of Hyperbolic Functions
21 topics
2.5. Determinants
2.5.1. The Determinant of a NxN Matrix
2.5.2. Finding Determinants Using Laplace Expansions
2.5.3. Basic Properties of Determinants
2.5.4. Further Properties of Determinants
2.6. Gaussian Elimination
2.6.1. Systems of Equations as Augmented Matrices
2.6.2. Row Echelon Form
2.6.3. Solving Systems of Equations Using Back Substitution
2.6.4. Elementary Row Operations
2.6.5. Creating Rows or Columns Containing Zeros Using Gaussian Elimination
2.6.6. Solving 2x2 Systems of Equations Using Gaussian Elimination
2.6.7. Solving 2x2 Singular Systems of Equations Using Gaussian Elimination
2.6.8. Solving 3x3 Systems of Equations Using Gaussian Elimination
2.6.9. Identifying the Pivot Columns of a Matrix
2.6.10. Solving 3x3 Singular Systems of Equations Using Gaussian Elimination
2.6.11. Reduced Row Echelon Form
2.6.12. Gaussian Elimination For NxM Systems of Equations
2.7. The Inverse of a Matrix
2.7.1. Finding the Inverse of a 2x2 Matrix Using Row Operations
2.7.2. Finding the Inverse of a 3x3 Matrix Using Row Operations
2.7.3. Matrices With Easy-to-Find Inverses
2.7.4. The Invertible Matrix Theorem in Terms of 2x2 Systems of Equations
2.7.5. Triangular Matrices
Vector Spaces
17 topics
3.8. Vectors in N-Dimensional Space
3.8.1. Vectors in N-Dimensional Euclidean Space
3.8.2. Linear Combinations of Vectors in N-Dimensional Euclidean Space
3.8.3. Linear Span of Vectors in N-Dimensional Euclidean Space
3.8.4. Linear Dependence and Independence
3.9. Subspaces of N-Dimensional Space
3.9.1. Subspaces of N-Dimensional Space
3.9.2. The Column Space of a Matrix
3.9.3. The Null Space of a Matrix
3.10. Bases of N-Dimensional Space
3.10.1. Finding a Basis of a Span
3.10.2. Finding a Basis of the Column Space of a Matrix
3.10.3. Finding a Basis of the Null Space of a Matrix
3.10.4. Expressing the Coordinates of a Vector in a Given Basis
3.10.5. Writing Vectors in Different Bases
3.11. Dimension and Rank in N-Dimensional Space
3.11.1. The Dimension of a Span
3.11.2. The Rank of a Matrix
3.11.3. The Dimension of the Null Space of a Matrix
3.11.4. The Invertible Matrix Theorem in Terms of Dimension, Rank and Nullity
3.11.5. The Rank-Nullity Theorem
Diagonalization of Matrices
12 topics
4.12. Eigenvectors and Eigenvalues
4.12.1. The Eigenvalues and Eigenvectors of a 2x2 Matrix
4.12.2. Calculating the Eigenvalues of a 2x2 Matrix
4.12.3. Calculating the Eigenvectors of a 2x2 Matrix
4.12.4. The Characteristic Equation of a Matrix
4.12.5. Calculating the Eigenvectors of a 3x3 Matrix With Distinct Eigenvalues
4.12.6. Calculating the Eigenvectors of a 3x3 Matrix in the General Case
4.13. Diagonalization
4.13.1. Diagonalizing a 2x2 Matrix
4.13.2. Diagonalizing a 3x3 Matrix With Distinct Eigenvalues
4.13.3. Diagonalizing a 3x3 Matrix in the General Case
4.13.4. Symmetric Matrices
4.13.5. Diagonalization of 2x2 Symmetric Matrices
4.13.6. Diagonalization of 3x3 Symmetric Matrices
Orthogonality & Projections
16 topics
5.14. Inner Products
5.14.1. The Dot Product in N-Dimensional Euclidean Space
5.14.2. The Norm of a Vector in N-Dimensional Euclidean Space
5.14.3. Introduction to Abstract Vector Spaces
5.14.4. Defining Abstract Vector Spaces
5.14.5. Inner Product Spaces
5.15. Orthogonality
5.15.1. Orthogonal Vectors in Euclidean Spaces
5.15.2. The Cauchy-Schwarz Inequality and the Angle Between Two Vectors
5.15.3. Orthogonal Complements
5.15.4. Orthogonal Sets in Euclidean Spaces
5.15.5. Orthogonal Matrices and Linear Transformations
5.16. Orthogonal Projections
5.16.1. Projecting Vectors Onto One-Dimensional Subspaces
5.16.2. The Components of a Vector with Respect to an Orthogonal or Orthonormal Basis
5.16.3. Projecting Vectors Onto Subspaces in Euclidean Spaces (Orthogonal Bases)
5.16.4. Projecting Vectors Onto Subspaces in Euclidean Spaces (Arbitrary Bases)
5.16.5. Projecting Vectors Onto Subspaces in Euclidean Spaces (Arbitrary Bases): Applications
5.16.6. The Gram-Schmidt Process for Two Vectors
Singular Value Decomposition
10 topics
6.17. Quadratic Forms
6.17.1. Bilinear Forms
6.17.2. Quadratic Forms
6.17.3. Positive-Definite and Negative-Definite Quadratic Forms
6.17.4. Constrained Optimization of Quadratic Forms
6.18. Singular Value Decomposition
6.18.1. The Singular Values of a Matrix
6.18.2. Computing the Singular Values of a Matrix
6.18.3. Singular Value Decomposition of 2x2 Matrices
6.18.4. Singular Value Decomposition of 2x2 Matrices With Zero or Repeated Eigenvalues
6.18.5. Singular Value Decomposition of Larger Matrices
6.18.6. Singular Value Decomposition and the Pseudoinverse Matrix
Applications of Linear Algebra
5 topics
7.19. Linear Least-Squares Problems
7.19.1. The Least-Squares Solution of a Linear System (Without Collinearity)
7.19.2. The Least-Squares Solution of a Linear System (With Collinearity)
7.20. Linear Regression
7.20.1. Linear Regression
7.20.2. Polynomial Regression
7.20.3. Multiple Linear Regression
Multivariable Calculus
17 topics
8.21. Partial Derivatives
8.21.1. Introduction to Multivariable Functions
8.21.2. Limits and Continuity of Multivariable Functions
8.21.3. Introduction to Partial Derivatives
8.21.4. Geometric Interpretations of Partial Derivatives
8.21.5. Partial Differentiability of Multivariable Functions
8.21.6. The Multivariable Chain Rule
8.22. Vector-Valued Functions
8.22.1. Defining Vector-Valued Functions
8.22.2. Derivatives of Vector-Valued Functions
8.22.3. The Gradient Vector
8.22.4. Directional Derivatives
8.22.5. The Multivariable Chain Rule in Vector Form
8.23. Double Integrals
8.23.1. Evaluating Double Integrals Over Rectangular Domains
8.23.2. Defining Double Integrals Over Non-Rectangular Domains
8.23.3. Properties of Double Integrals
8.23.4. Type I and Type II Regions in Two-Dimensional Space
8.23.5. Double Integrals Over Type I Regions
8.23.6. Double Integrals Over Type II Regions
Probability & Random Variables
25 topics
9.24. Probability
9.24.1. Introduction to Bayes' Theorem
9.24.2. Generalizing Bayes' Theorem
9.24.3. Extending the Law of Total Probability
9.25. Random Variables
9.25.1. Probability Density Functions of Continuous Random Variables
9.25.2. Cumulative Distribution Functions for Continuous Random Variables
9.25.3. One-to-One Transformations of Discrete Random Variables
9.25.4. Many-to-One Transformations of Discrete Random Variables
9.25.5. The Distribution Function Method
9.25.6. The Change-of-Variables Method for Continuous Random Variables
9.25.7. The Distribution Function Method With Many-to-One Transformations
9.25.8. Simulating Observations
9.26. Expectation
9.26.1. Expected Values of Discrete Random Variables
9.26.2. Expected Values of Transformed Discrete Random Variables
9.26.3. Moments of Discrete Random Variables
9.26.4. Variance of Discrete Random Variables
9.26.5. Properties of Variance for Discrete Random Variables
9.26.6. Expected Values of Continuous Random Variables
9.26.7. Variance of Continuous Random Variables
9.26.8. The Rule of the Lazy Statistician
9.27. Uniform Distributions
9.27.1. The Discrete Uniform Distribution
9.27.2. Modeling With the Discrete Uniform Distribution
9.27.3. The Mean and Variance of the Discrete Uniform Distribution
9.27.4. The Continuous Uniform Distribution
9.27.5. The Mean and Variance of the Continuous Uniform Distribution
9.27.6. Modeling With the Continuous Uniform Distribution
Combining Random Variables
24 topics
10.28. Distributions of Two Discrete Random Variables
10.28.1. Joint Distributions for Discrete Random Variables
10.28.2. Marginal Distributions for Discrete Random Variables
10.28.3. Independence of Discrete Random Variables
10.28.4. Conditional Distributions for Discrete Random Variables
10.28.5. The Joint CDF of Two Discrete Random Variables
10.29. Distributions of Two Continuous Random Variables
10.29.1. Joint Distributions for Continuous Random Variables
10.29.2. Marginal Distributions for Continuous Random Variables
10.29.3. Independence of Continuous Random Variables
10.29.4. Conditional Distributions for Continuous Random Variables
10.29.5. The Joint CDF of Two Continuous Random Variables
10.29.6. Properties of the Joint CDF of Two Continuous Random Variables
10.30. Expectation for Joint Distributions
10.30.1. Expected Values of Sums and Products of Random Variables
10.30.2. Variance of Sums of Random Variables
10.30.3. Computing Expected Values From Joint Distributions
10.30.4. Conditional Expectation for Discrete Random Variables
10.30.5. Conditional Expectation for Continuous Random Variables
10.30.6. The Rule of the Lazy Statistician for Two Random Variables
10.31. The Correlation Coefficient
10.31.1. The Covariance of Two Random Variables
10.31.2. The Correlation Coefficient of Two Random Variables
10.31.3. Interpreting the Correlation Coefficient
10.32. Normally Distributed Random Variables
10.32.1. Combining Two Normally Distributed Random Variables
10.32.2. Combining Multiple Normally Distributed Random Variables
10.32.3. I.I.D Normal Random Variables
10.32.4. The Bivariate Normal Distribution
Parametric Inference
30 topics
11.33. Point Estimation
11.33.1. The Sample Mean
11.33.2. Statistics and Sampling Distributions
11.33.3. The Sample Variance
11.33.4. Variance of Sample Means
11.33.5. Sampling Distributions of Sample Means From Normal Populations
11.33.6. The Student's t-Distribution
11.33.7. Distributions of Sample Means With Unknown Population Variance
11.33.8. The Central Limit Theorem
11.33.9. Distributions of Sample Variances
11.33.10. The Sample Covariance Matrix
11.33.11. Likelihood Functions
11.33.12. Maximum Likelihood
11.34. Hypothesis Testing
11.34.1. Hypothesis Testing
11.34.2. One-Tailed and Two-Tailed Hypothesis Tests
11.34.3. The Significance Level of a One-Tailed Hypothesis Test
11.34.4. The Significance Level of a Two-Tailed Hypothesis Test
11.34.5. Critical Regions and Critical Values in Hypothesis Testing
11.34.6. Type I and Type II Errors in Hypothesis Testing
11.34.7. Hypothesis Tests for the Mean of a Normal Distribution
11.34.8. Hypothesis Tests Using the Central Limit Theorem
11.34.9. P-Values in Hypothesis Testing
11.34.10. The Z-Test
11.34.11. The T-Test
11.34.12. The Paired T-Test
11.35. Confidence Intervals
11.35.1. Confidence Intervals for Population Means: Known Population Variance
11.35.2. Confidence Intervals for Population Means: Unknown Population Variance
11.35.3. Confidence Intervals for Two Means
11.35.4. Confidence Intervals for Variances
11.35.5. Confidence Intervals for Proportions
11.35.6. Confidence Intervals With Linear Regression Parameters