Solved – XGboost for Time series – using lag of target variables

boostingforecastinglagsmachine learningtime series

I'm trying to make a time series forecast using XGBoost. I have already added many time related variables – day_of_week, month, week_of_month, holiday.

I want to add lagged values of target variable but not sure what is the right approach to build a model with lags. Should the train set have lagged values based on actual data to build model, and test set should have iterative/recursive approach for developing lags?

Thanks!!

Best Answer

I would say that yes, using actual observations during training and and predicted observations during real use is valid.

This is a common approach in natural language generation.

Related Question