← Module 01 / Getting started & notation

Lesson 01.1 · §1 About

The math behind a prediction

Meet the three toolkits—and learn what this course and its source actually cover.

In this lesson 5 ideas
  1. Begin with something you can see
  2. What the original notes promise
  3. Mathematics for ML, rather than a catalog of algorithms
  4. How to use this course
  5. Source access and corrections

Begin with something you can see

Three observations sit on a graph. A line offers a simple prediction: multiply the input by a slope. Move the slope and notice how far the predictions fall from the observations.

Explore it yourself

Three kinds of mathematics, one question

Which line fits these observations? The picture connects the tools you will learn.

Preparing interactive controls…

xy0-3-2-11234

Prediction: y = 1.00x · Mean squared error: 2.000

Linear algebraOrganize inputs and predictions as vectors.

CalculusChange the slope to reduce error.

ProbabilityDescribe noisy observations and uncertainty.

The dashed vertical gaps are residuals: observed value minus prediction. Squaring each gap and taking the average gives the displayed error. This tiny example is a teaching addition, not a model taught in the original notes.

For inputs x=(1,2,3)⊤\mathbf x=(1,2,3)^\top and observations y=(2,3,5)⊤\mathbf y=(2,3,5)^\top, the predictions are wxw\mathbf x. The average squared error is

L(w)=13∑i=13(wxi−yi)2.L(w)=\frac13\sum_{i=1}^{3}(wx_i-y_i)^2.

Linear algebra organizes the three numbers. Calculus tells us how a small change to ww changes LL. Probability helps us describe why observed values might vary even at the same input. You do not need to solve the optimization yet. First recognize the different jobs.

What the original notes promise

Garrett Thomas wrote Mathematics for Machine Learning at the Department of Electrical Engineering and Computer Sciences, University of California, Berkeley. The supplied version is dated January 11, 2018.

Its purpose is to summarize the mathematical background for an introductory machine learning class, called CS 189/289A at UC Berkeley. Machine learning draws on several mathematical fields; these notes collect some of their essential tools.

The source assumes familiarity with multivariable calculus and linear algebra at the level of Berkeley Math 53/54. It explicitly says it is not a replacement for those prerequisite classes. Most topics are treated briefly. References direct interested readers to fuller treatments.

That matters for this website: module 0 supplies an introductory bridge, while later lessons unpack the source in more detail. The bridge is a starting point, not the equivalent of two complete college mathematics courses.

Mathematics for ML, rather than a catalog of algorithms

The source is about mathematical background, not machine learning itself. It does not teach specific models or algorithms except for occasional mentions that show why a mathematical idea matters. This website adds small applications to make the math tangible. They are labeled as teaching examples; they do not change the original scope.

Earlier versions of the source had no proofs. The author began adding proofs when they were reasonably short and helped understanding. Those proofs were not required background for CS 189, but were included to deepen understanding. Here, all proofs supplied by the source will remain available when their sections are implemented.

How to use this course

  1. Observe: describe what changes in a figure before reading the formula.
  2. Predict: decide what you expect a control to do.
  3. Explain: connect the numerical change to the symbols.
  4. Generalize: read the definition, assumptions, and proof.
  5. Check: try a case where the assumptions fail.

If symbols are unfamiliar, continue through this module. If functions or calculus feel uncertain, start with module 0. Neither route requires memorizing the whole symbol table in advance.

Make a prediction

What is the main purpose of Thomas’s notes?

Source access and corrections

The author states that the document may be freely distributed. The source gives this location for its latest version, and asks that mistakes be reported to gwthomas@berkeley.edu. This project follows the local 47-page PDF, so a later online version may differ. These links reproduce the source’s access and correction information; the website does not send any message on your behalf.