# How to perform an actual time series prediction using xgboost- python

I have train data for 5 months and test data for one month which i am using to validate my model.Here is the xgboost code i wrote in python-\

dtrain = xgb.DMatrix('Train.csv?format=csv&label_column=4')
dtest = xgb.DMatrix('Test.csv?format=csv&label_column=4')

watchlist = [(dtrain, 'train'), (dtest, 'test')]
xgb_pars = {'min_child_weight': 1, 'eta': 0.5, 'colsample_bytree': 0.9,
'max_depth': 6,
'subsample': 0.9, 'lambda': 1., 'nthread': -1, 'booster' : 'gbtree', 'silent': 1,
'eval_metric': 'rmse', 'objective': 'reg:linear'}

model = xgb.train(xgb_pars, dtrain, 10, watchlist, early_stopping_rounds=2,
maximize=False, verbose_eval=1)

print('Modeling RMSLE %.5f' % model.best_score)
pred = model.predict(dtest)


Now I need to predict the values for the next month(future).Can someone help me with the code.Thanks for all the help in advance

• This question seems better fit for the normal stack overflow as it’s a pure coding question. You may have better luck there. – kbrose May 30 '18 at 14:06