Derivatives are slopes
Not met yet
The derivative of a function at a point is its slope there: how fast the output changes for each unit the input moves, measured over a tiny move. A straight line has the same slope everywhere, but a curve doesn't: the slope of x ** 2 is 2 * x, and in general the slope of x ** n is n * x ** (n - 1). Adding a constant lifts a curve without tilting it, so a constant's slope is 0, and slopes add and scale just as the functions do. A positive slope means the output rises as the input grows, a negative one means it falls, and 0 means flat, as at the bottom of a valley. With several inputs, a partial derivative is the slope in one direction with the others held still, so a loss has one slope for w and another for b.
Try it
main.pyOutput
Press Run and what your program prints shows up here.
Easy to get wrong
- Thinks a function's slope at a point is its value there, so a high point must be steep and a flat point must be at 0.
- Thinks a curve has one slope everywhere, like a straight line, so the slope of x ** 2 is 2 at every x.
- Thinks adding a constant to a function changes its slope, rather than only lifting the whole curve.
- Thinks a partial derivative moves every input at once, rather than one input with the rest held still.