What to learn before machine learning

A man adjusts the Mark I Perceptron, a 1960 experimental machine that learned to recognise letters, beside a large white letter C.
The Mark I Perceptron in a US Navy photograph released on 24 June 1960. The Navy caption says the machine “can be trained to automatically identify objects or patterns, such as letters of the alphabet.” Photo: National Museum of the U.S. Navy, public domain, via Wikimedia Commons.

Before machine learning, study three mathematical subjects: linear algebra, to describe data as vectors and matrices; probability, to reason about noisy data; and calculus, to measure how a model’s error changes when its settings change. On ManySpace’s prerequisite map, linear algebra and calculus come first, probability follows calculus, and the AI courses build on all three.

Key takeaways

  • Machine learning relies on three mathematical strands: linear algebra for data, probability for uncertainty and calculus for training.
  • On the map, Linear Algebra needs Algebra II and Proof Techniques, Probability depends mostly on Calculus II, and Neural Networks needs Calculus I.
  • Start the AI track with Foundations of Learning, which has no mandatory prerequisite course on the map.
  • Judge readiness by whether you can use an idea on a problem you have not seen, not by whether its notation looks familiar.
Contents
  1. Why the mathematics matters
  2. Linear algebra: data as vectors and matrices
  3. Probability: learning from uncertain data
  4. Calculus: how a model improves
  5. A practical order
  6. How to check you are ready
  7. What ManySpace covers, and what it does not
  8. Frequently asked questions
  9. Related reading

Why the mathematics matters

A machine learning model is a function with adjustable settings, together with a measure of how wrong its outputs are. Learning means changing the settings so that the measured error becomes smaller. The three subjects below are the parts of that sentence you cannot skip.

The idea is older than most of the tools people use today. The machine in the photograph was trained from examples to recognise letters of the alphabet. Modern systems use far more data and far more computation, but the basic loop has the same shape: make a prediction, measure the error, adjust the settings. To understand what a modern model is doing, and why it fails when it fails, you need the mathematics behind that loop.

Linear algebra: data as vectors and matrices

Linear algebra is the language the other two subjects are written in. A vector is an ordered list of numbers, such as the features of one example. A matrix stacks many of those vectors into a table with one row per example. A linear model turns features into a prediction by multiplying a vector by a matrix of weights, and much of the arithmetic inside a neural network is that same operation repeated.

Three topics do most of the work:

  • Matrix algebra, the reading and multiplying of the tables that hold data and weights.
  • Orthogonal projections and least squares, which explain the best-fitting line: it is the one that makes the sum of squared residuals as small as possible.
  • Eigenvalues and eigenvectors, the directions a matrix only stretches. They are the core of principal component analysis, a standard way to find the main directions of variation in a dataset.
A linear regression plot with the residual sum of squares and the explained sum of squares marked.
A linear regression plot showing the residual and explained sums of squares. Least squares chooses the line that keeps these residuals small overall. Image: QuantuMechaniX8, CC0, via Wikimedia Commons.

On the map, the Linear Algebra course lists Algebra II and Proof Techniques as mandatory prerequisites. Work through the matrix algebra topic first, then move to eigenvalues and eigenvectors once matrix products feel routine. The eigenvectors lab lets you turn a vector until you find the directions that are only stretched.

Probability: learning from uncertain data

Probability is how a model says how sure it is. Four topics carry most of the weight:

  • Random variables and distributions, which describe the values a feature or a label can take and how often each occurs.
  • Expectation and variance, which summarise a distribution. A training loss is usually an average over examples, so it is an expectation estimated from data.
  • Conditional probability and Bayes’ theorem, which update a belief when new evidence arrives. Naive Bayes classifiers apply that rule directly.
  • The law of large numbers and the central limit theorem, which explain why averages over samples settle down, and why a score measured on a finite test set is only an estimate.

Build these in the Probability course, starting with random variables and distributions and expectation and variance. Most of its mandatory links point to Calculus II, so plan calculus before probability. The Bayes’ theorem topic pairs with the Bayes lab, which shows how the base rate changes what a positive test result means. For the averages, read the law of large numbers and the central limit theorem, and use the probability lab to watch an average settle over repeated flips.

Calculus: how a model improves

Calculus matters most during training. A model’s error is a function of its settings. The derivative of that error with respect to one setting says how the error changes when that setting moves a little. Gradient descent uses this: it moves every setting a small step against its derivative, the direction in which the error falls fastest.

Steepest descent steps zig-zagging across the contour lines of a two-variable quadratic function toward its minimum.
Steepest descent on the contour lines of a two-variable quadratic. Each step moves against the gradient, which is what gradient descent does with a loss function. Image: Renwei4840, CC0, via Wikimedia Commons.

Three steps from Calculus I do most of the work:

  • The derivative as a rate of change, which tells you how fast a loss is falling at a point. The definition of the derivative is where that reading starts.
  • The chain rule, which differentiates a function built from other functions. A neural network is layers inside layers, and backpropagation is the chain rule applied one layer at a time.
  • Partial derivatives and the gradient, once a model has many settings. Each partial derivative is the rate of change along one setting, and the gradient collects them.

On the map, Neural Networks lists Calculus I as a mandatory prerequisite. The Learning as Optimization course depends on the Optimization course, which draws on Linear Algebra and Multivariable Calculus. Try the derivative lab for the rate of change, the gradient descent lab to see how the step size decides whether a walker settles or overshoots, and the backpropagation lab to follow one blame path from the loss back to a weight.

A practical order

This order follows the prerequisite links on the map. Each step names what it needs.

  1. Algebra II and Proof Techniques, then Linear Algebra. Linear Algebra lists both as mandatory prerequisites.
  2. Precalculus, then Calculus I, Calculus II and Multivariable Calculus. Calculus I needs Precalculus. Calculus II needs Calculus I. Multivariable Calculus needs Calculus I and Calculus II.
  3. Probability. Most of its mandatory links point to Calculus II.
  4. Optimization. It draws on Linear Algebra and Multivariable Calculus.
  5. The AI courses. Start with Foundations of Learning, which has no mandatory prerequisite course. Learning as Optimization needs Linear Models and Optimization, and Neural Networks needs Learning as Optimization and Calculus I. The other AI courses link to each other, so use the course pages to see which topics come first.

The AI & ML subject page lists all of the AI courses in one place.

How to check you are ready

Familiarity with a formula is a weak test. A better one is whether you can use the idea on a problem you have not seen. ManySpace’s topic pages make the prerequisites explicit. Each one shows why the topic matters, where it is used, and the route to it, the ordered chain of topics that leads there. The Chain Rule page, for example, lists a route that starts at Natural Numbers, passes Function Notation & Composition and Polynomial Functions, and reaches the derivative topics before the chain rule itself.

When a step on a route feels unclear, go back to it before you continue. The route is the page’s own list, so it changes when the map does.

What ManySpace covers, and what it does not

ManySpace is a map and a study system for mathematics, physics and AI/ML. It does not teach programming, and there is no live tutoring. The About page is direct about this: every topic has a captioned lesson film, some topics also have a deeper interactive lesson, and the films were made with AI assistance and not all have been reviewed end to end by a subject expert. Its mastery figures are estimates built from recorded evidence, not a qualification, and its review schedule uses the open FSRS memory model.

The quickest way in is the set of free labs. There are eighteen of them, and each needs no account.

Frequently asked questions

Do I need calculus before machine learning?

Yes, for training. Gradient-based learning uses derivatives, and neural networks depend on the chain rule. On ManySpace’s map, Neural Networks lists Calculus I as a mandatory prerequisite. You can start the early AI courses with a lighter command of calculus, but finish Calculus I before neural networks.

Which should I study first, linear algebra or calculus?

On the map they do not depend on each other. Linear Algebra needs Algebra II and Proof Techniques, while Calculus I needs Precalculus, Algebra I and Trigonometry. Probability depends mostly on Calculus II, so calculus comes before probability.

How much probability do I need?

Enough to read a distribution, compute an expectation, apply Bayes’ theorem to a test result, and explain what the law of large numbers says about averages. Use the Probability course as the checklist and the Bayes lab as a quick test of the base-rate idea.

Do I need to program before I study this?

ManySpace covers mathematics, physics and AI/ML, not programming. Many people practise code alongside the mathematics, but that is a separate plan.

Can I use machine learning libraries without the mathematics?

You can run existing libraries without deriving anything. When training goes wrong, such as a loss that will not fall or a model that is confidently wrong, the diagnosis uses gradients, distributions and matrix shapes.

How long will it take?

It depends on your starting point, and no page can promise a time. Topic pages show a study time estimate for each topic; read it as an estimate.