0
$\begingroup$

Im building a forecast using an LSTM in tensorflow 2.

My data consists of 7 columns: date (daily), gross_sales (the target), daily_total_inventory, avg_daily_order_value, daily_total_new_customers, is_holiday (1/0), is_promo_day (1/0).

My aim is to predict gross sales based on the historical values of past gross sales and all other variables (inventory, avg order value, new customers, whether it was a holiday, and whether there was a promotion going on).

However, I also have a planned schedule for future promotional days that I want my model to take into account when predicting gross sales. For example, every time there is a promotion going on, sales increase significantly compared to non-sale days. So when my model is making predictions, it needs to consider whether or not that future day will have a promotion or not. However I'm not sure how to shape this data, or appropriately load it into an LSTM.

$\endgroup$
3
  • $\begingroup$ I think you might have answered your own question here. In terms of representing sales days as the output, you simply add this binary feature to the output, along with your gross sales feature. Also, what do you refer to as "shaping your data"? Do you pre-processing the data in a way that the model can use it as input? $\endgroup$
    – shepan6
    Sep 7, 2020 at 8:31
  • $\begingroup$ I thinks there's some miscommunication. There is no gross sales feature for future days. I only have a list of future days where I will have promos. The model is trained on past sales and past promos are part of the model. So my question is, when I run a prediction how can I make it so that I feed this list of future promo days into my model to consider when predicting sales? $\endgroup$ Sep 7, 2020 at 17:39
  • $\begingroup$ Did we find the intuition for this? I am stuck with the same type of problem. $\endgroup$ Feb 15 at 14:03

1 Answer 1

0
$\begingroup$

That is called multivariate time-series. An input array (typically called X) needs to be constructed where each time point is a row and each feature is in a different column. One of the columns will be boolean values to encode promo/no promo for a given time point (typically called an indicator vector).

To make future predictions, the Model.predict() method will be called on a new array. This new array will encode the new data, including promo/no promo feature column.

It might be more straightforward to use the Prophet package which is designed for time series forecasting, including the ability to model holiday/promo days.

$\endgroup$
1
  • $\begingroup$ I want to try doing it with LSTM or a normal dense layer neural networks only. In that case I understood the intuition of passing the "indicator" vector. But how do I teach the network that while predicting the value of a future date, consider if it is a promo or a non promo day? is there way I can do this? $\endgroup$ Feb 16 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.