Introduction
Calculus is the mathematics of change.
In machine learning, we use calculus to answer questions like:
- How does the loss change when a weight changes?
- Which direction should a parameter move?
- How does error flow backward through a network?
- Which part of a computation is most sensitive?
The main object in this chapter is the derivative.
The Main Idea
A derivative measures local rate of change.
If a function is a curve, the derivative at one point is the slope of the curve at that point.
In ML, the same idea becomes a practical tool. If a parameter changes slightly, the derivative tells how the loss is expected to change.
The word "local" matters. A derivative does not describe the whole function everywhere. It describes what the function is doing near the current input.
That is exactly the situation in training. A model has its current parameters. We do not need to understand every possible parameter setting before taking one step. We need to know which small change is likely to reduce the loss now.
The Three Questions
When reading a calculus expression, ask:
- What quantity is changing?
- What is it changing with respect to?
- Where are we measuring the change?
For example, in:
the loss L changes with respect to the weight w. The value of the derivative
depends on the current value of w.
What This Chapter Covers
This chapter introduces:
- change and slope
- derivatives of one-variable functions
- partial derivatives
- gradients
- directional derivatives
- Jacobians
- Hessians at a working level
- chain rule
- computation graphs
- backpropagation
The goal is not to prove calculus from limits. The goal is to understand how gradients make learning possible.
What We Will Keep Simple
We will use small functions and visible arithmetic. Later chapters can discuss automatic differentiation, numerical stability, and large neural networks. Here, the priority is to understand what gradients mean before treating them as framework output.
Before Moving On
You should be comfortable with functions, vectors, matrices, dot products, and the idea that a model computes a loss from inputs and parameters.