The loss landscape lesson ends with a walker who never sees the map. It feels only the ground under its feet, steps downhill, and stops when nothing next to it is lower. Where it stops depends entirely on where it started.
A model with a single weight has been evaluated at 11 evenly spaced settings of that weight. Here is the loss at each one:
| setting | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| loss | 4.0 | 3.1 | 2.3 | 1.8 | 1.6 | 1.9 | 2.4 | 1.2 | 0.5 | 1.4 | 3.3 |
Training could begin at any of the 11 settings, so before trusting a single run it is worth knowing what happens from all of them.
Task: write downhill_walks(losses), which walks downhill from every setting in turn and returns [share_lowest, average_final], each rounded to 4 decimal places.
losses[i] is the loss with the weight at setting i, and there is at least one setting. Settings 0 and n - 1 are the two ends of the dial: setting 0 has only a right-hand neighbour and setting n - 1 only a left-hand one. The dial does not wrap around.share_lowest is the fraction of starting settings whose walk stops at a setting holding the lowest loss anywhere on the dial. If several settings tie for that lowest loss, stopping at any of them counts.average_final is the average, over every starting setting, of the loss at the setting where that walk stops.The dial above is the first test.
Nothing promises that the deepest valley collects the most starting points. A walker that settles in a shallower dip, or on a flat stretch, has no way of learning that something better lies a few settings away.
This ball is stuck in a dip that is not the deepest one. That is a local minimum, and the ball has no way of knowing a better dip exists. A rolling ball only ever feels the ground right under it, so it stops at the first flat spot it reaches. Move the starting point and roll again to land somewhere else.
Once your code passes every test, a reference solution shows up here so you can compare it with yours.