Adaptive Neural Networks Using Residual Fitting