1

I am currently using XGBoost to predict sales in the future. My time series data is given per week interval. But I am not sure how can I do multistep forcasting using XGBoost. I split my data set into train and test and after training the model I use my test set to predict the sales. But I only get prediction on the actual values that I have not on the future weeks that are beyond the test set. Here are some code for clarification:

# train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y,
                                                    test_size=0.3,
                                                    random_state=0, 
                                                    shuffle=False)

reg = xgb.XGBRegressor(objective='reg:squarederror', n_estimators=1000, nthread=24)
reg.fit(X_train, y_train)

# predicting 
predictions_xgb = reg.predict(X_test)

Can I get some help on this?

Danylo Baibak
  • 2,106
  • 1
  • 11
  • 18
abstract
  • 11
  • 1
  • Assuming at least some of your parameters are time based, simply change the time based parameters to reflect the times you care about in the future. – Benjamin Trent Apr 28 '22 at 12:33

0 Answers0