Gradient Descent by Hand
Take gradient descent steps with a pencil and feel how learning rates make or break training
A taste of a lesson
With f(w) = (w - 3)^2, start w = 0 and learning rate 1.0, my w goes 0, 6, 0, 6... What's wrong?
Nothing is wrong with your arithmetic; the learning rate is exactly too big. At w = 0 the gradient is -6, and stepping 1.0 times that moves you to 6, the same distance past the minimum on the other side. At 6 the gradient is +6, so you jump back to 0. Each step overshoots by exactly the gap. Try learning rate 0.4 and fill in three steps. Before you calculate, predict: will you approach 3 smoothly, or bounce around it while getting closer?
Written with AI under Skill Lab's direction as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong. Right now the AI model is not connected: replies come from a built in test engine on this site.
What you will be able to do
- Perform gradient descent updates by hand
- Predict the effect of small, good and too large learning rates
- Extend descent to two parameters and fit a line to data
- Explain how feature scaling changes convergence
- Compare full batch, stochastic and mini batch updates
Lesson plan
- 1 Walking downhill Perform gradient descent updates on a one parameter function. Start
- 2 Choosing the learning rate See slow, fast, oscillating and diverging behaviour. Start
- 3 Two parameters Update two parameters using partial derivatives. Start
- 4 Fitting a line Use gradient descent to fit a line to a few data points. Start
- 5 Scaling features Understand why scaling speeds up convergence. Start
- 6 Batches and stopping Compare update styles and decide when to stop. Start
Try asking
About this tutor
A beginner tutor that makes gradient descent tangible. You will minimise simple functions by hand, step by step, choose learning rates that work, and watch what happens when they are too small, too large or wildly too large. Lessons then extend the idea to two parameters, to fitting a line to data, and to the difference between full batch, stochastic and mini batch updates. You will also see why feature scaling changes how quickly descent converges. Each lesson includes a short table of steps to fill in with a calculator.
Reviews
Students can review a tutor after a paid lesson. Nobody has yet.
More like this
Other tutors on the same or nearby topics.