Optimal Nonlinear Prediction of Random Fields on Networks