Glossary · Machine learning
Hill climbing
Also called local search, random search
A simple search method: make a small random change, keep it if it improves the score, and repeat.
Hill climbing searches for the best settings by trial and improvement:
- Start with a guess .
- Try a nearby change , for example a small random nudge to one joint angle.
- If the score improves, for an error you want to minimise, keep .
- Repeat until no small change helps.
It needs no gradient, so it works on any score you can compute, even one with discontinuities or with parts that are awkward to differentiate. That makes it handy for one-off fitting problems.
Its weakness
Hill climbing stops at the first point where every small step makes things worse, a local optimum, which may not be the best answer overall. Common fixes are restarting from several different guesses, or sometimes accepting a worse step (simulated annealing). When a good starting guess exists, as with a standing human, local optima are less of a worry.
Compared with gradient descent
Gradient descent uses the slope to choose each step, so it scales to millions of parameters. Hill climbing tries steps blindly and only suits problems with tens of parameters, like a pose.
In this project
solve_stance.py hill-climbs the leg, trunk and arm joints until the body meets the coach’s stance description: a 70/30 weight split, foot angles, stance size, an upright trunk and a high guard. The error combines those targets, including where the centre of mass sits between the feet.