Classical Machine Learning

Take a useful step downhill

BOTIE

The supplied derivative tells us the slope of the error at the current coefficient. Build an update that subtracts half the gradient.
Ready to test
0 passed · 0 failed · 3 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Try a zero gradient, then reverse its sign. Predict the direction of the parameter update before inspecting the result. What would a much larger gradient do with the same step size?

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

The supplied derivative tells us the slope of the error at the current coefficient. Build an update that subtracts half the gradient.

A coefficient needs adjustment and its current loss derivative is supplied. Botie will make one step before any new derivative could be calculated.

Scale the supplied gradient by 0.5 and subtract that amount from the current parameter.

Examples and results
Current parameter
0
Current gradient
-6
Required result
3
Current parameter
4
Current gradient
0
Required result
4
Current parameter
-2
Current gradient
2
Required result
-3
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

An update crosses zero

This check uses the pieces from “Use the derivative's sign to choose a step”.

BOTIE

The current parameter is positive and the gradient points upward. Predict the next parameter using the workshop's fixed step size of 0.5.
Current parameter
1
Current gradient
6

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

Why would another step need a newly calculated gradient, and why does this fixed learning rate not guarantee improvement for every loss?

An update rule combines current state, current derivative and step size; fitting repeats that process with fresh information.

This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out.

Work through the Python challenges →
Continue the courseRidge & Lasso →
← Multiple & Polynomial Regression