# Adding time as a feature with xgboost/random forests

I am trying to use xgboost for performing some regression and the features I have are rather simple and limited. I have the time stamp associated with some measurements. The measurements are customer counts and the dependent variable is predicting the average customer wait time. There is dependence on time of the day and weekends as well. For example, I notice that wait times are longer in thee afternoon than in the morning and evenings. There is also a dependency on weekday, holiday or weekends. So I also added a boolean variable to indicate whether the given day is a weekend or holiday or not.

The time data I have is in 10 minutes interval and is a regular python time stamp with the date, hours, minutes and second granularity. How should such time features be included with xgboost or random forests or indeed any such modelling paradigms?

• Thanks for the answer. I guess hour could be an integer/discrete variable running between 0-23 or is it worth it to make time as a continuous variable for hour and minutes? Mark your time features as categorical: Do you mean the weekend/holiday like boolean variables? Could you also clarify on your last point. Make sure your don't leak information and that your validation set is representative.. I was going to use some continuous data history as training and maybe predict use an hour or so worth of future data (relative to training set) as validation set.