The concept is described in
The prototype of chain with two predictive models, in which second model corrects the error of first model should be implemented (for ts forecasting and regression).