Simple way to create "lags" when testing time series models

Viewed 28

I'm currently using LightGBM to do some time series predictions and I'm using lags as one of my features. I'm right now creating code to create predictions on the test sets and I need to fill in the lags with the predictions my model makes to simulate real-world performance. To do this, I'm iterating through rows of my dataset, making predictions on each row, saving the n-th latest predictions in a list and then rewriting the next row accordingly. This works, but is ugly and inconvenient to do every time. Is there a nice sklearn-esque package I can use instead?

0 Answers
Related