Probably my title is not as precise as I'd like it to, but bear with me, the problem is quite straightforward: I have daily time-series sales and stock data, from January to May, both in 2018 and 2019. In May, some products' stock are adjusted (because of differences between virtual and real stock). Using data from 2018 I want to train a model that's able to predict if products will be adjusted in May 2019.

I'm thinking of two approaches to train it: the first one would be to mark every data point with a will_be_adjusted label, like this:

product_id   date         sales    will_be_adjusted  ...
   1         20180101       1           0
   1         20180201       3           0
   1         20180105       8           0
   2         20180101       2           1
   2         20180201       6           1
   2         20180105       7           1

So, product 1 won't be adjusted in May, and product 2 will be. My gut feeling tells me that if my label is based on a product aggregation level, then my data should also be aggregated at product level (not product-date level, like this case). Is this right?

If what I said is right, I was thinking of creating a dataframe on a product aggregation level, based on the last day where there's information available, like this:

product_id   sales         sales_shift    will_be_adjusted  moving_average  ...
   1         12                 10                   0          3.2
   2         8                  7                    1          4.1

Every day the model would be run to get the probabilities of a given product being adjusted in May. So my question is, is the first approach statistically correct? Should I go for the second one? If I'm not explaning myself correctly, please tell me and I'll try to elaborate.

Edit: answering some questions: I have more than 10,000 product id's, stocks are adjusted with a decrease of virtual stock. I have an adjustment variable that is mostly zeroes, but when there's an adjustment it has a negative number that's the estimation of the difference between virtual stock and real stock (we don't care about positive differences). The idea of the model is to be able to know before an adjustment if a product will need it. The date of the adjustment isn't deterministic, might be every three months, every eight, etc. There was the coincidence that in two consecutive years there was an adjustment in May and so we decided to use data from January to May in both years, because they're more comparable

  • $\begingroup$ So you have multiple time series? Any other variables? How are stocks adjusted? Is it deterministic? Are there some rules for when to adjust stocks? How do you predict whether a stock will be adjusted based on time series data? $\endgroup$ – user2974951 Aug 21 at 6:02
  • $\begingroup$ Sorry, I posted this before leaving work, I'll expand now $\endgroup$ – Juan C Aug 21 at 14:11

Your Answer

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

Browse other questions tagged or ask your own question.