Non-parametric regression as an AI planning problem