skipnothing/Math for Machine Learning
UNIT 02

Calculus for ML

Derivatives, gradients, and the chain rule, how models find the bottom

Calculus is the engine of optimization, every ML model that 'learns' is using derivatives to improve.

Loading…
TOPICS
#5

Functions & Graphing

Read a graph as the rule that produced it, separate the inputs a function accepts from the outputs it produces, and tell a straight rule from a bending one by whether equal input steps lift the output equally, then read that same shape in a training loss curve.

Feed 20 into the rule `C × 9/5 + 32` and exactly one number falls out: 68. Plot every input beside its output and the rule stops being arithmetic, it becomes a shape you can read at a glance.

10 min
#6

Derivatives & Slope

Shrink a secant until it settles into the tangent to read a curve's slope at one point, differentiate polynomials term by term with the power rule, and step against the slope's sign to walk a loss curve downhill.

Walk a curved hillside and the ground tilts differently under every footstep; the height follows a rule as plain as `x**2`, yet its steepness keeps shifting, and pinning that steepness to one exact spot is the whole move here.

14 min
#7

Partial Derivatives

Freeze every input but one so a multi-input surface collapses to an ordinary curve, read the partial derivative as that slice's slope, and give each model parameter its own partial of the error.

Stand on a hill whose height obeys `f(east, north)` and ask how steep the ground is; it answers with a question, steep which way? Face north, then face east, and the same spot gives two different answers.

14 min
#8

The Chain Rule

Multiply the local slopes of nested stages to get a composition's slope, evaluate each outer slope at the value its inner stage produced, and read the same product stacked deep as the backpropagation a network runs to reach every weight.

Turn one dial and it drives a second stage, then a third, so the machine's response to your turn is every stage's response multiplied down the line, the exact arithmetic a network runs the moment `loss.backward()` fires.

16 min
#9

Gradients & Directional Derivatives

Stack a point's partial derivatives into the gradient arrow, read its direction as the steepest way uphill and its length as the climb rate, then flip its sign to step a loss surface downhill.

Last topic you measured a hill's steepness one axis at a time, north then east, landing two numbers like `(+8, -3)`, yet neither points the steepest way to walk. Stack them into one arrow and it aims straight uphill.

14 min
#10

Integrals (Basics)

Sum a rate curve's thin strips until the running total settles on one exact area, then point the same summing at a probability density so the area between two marks becomes the chance of landing there.

A speedometer holding at `20` meters a second for five seconds puts you 100 meters down the road, a plain width times height. Let the needle drift and that tidy rectangle buckles into a curved patch you have to rebuild.

12 min
All units