0
$\begingroup$

Suppose I have a time series. Let's say it is of the number of sales in a shop. Suppose I am looking to make two models - model 1 which predicts future values by weekly time steps (total sales per week, i.e. 1-7 days from now, then 8-14 days from now, then 15-21, etc.) and model 2 which predicts future values by monthly time steps (total sales per month).

Note that I have not decided what models each of these will be yet. But I cannot assume that the data/features used to train each model will be the same.

Let's say I make predictions with both models for the period of time ranging from the start of September to the end of October (inclusive). So this is 3 months, in total consisting of exactly 13 weeks. Therefore I will have 13 predictions from model 1, and 3 predictions from model 2.

Let $S_1$ be the sum of the 13 predictions for model 1, and $S_2$ be the sum of the 3 predictions for model 2. How can I ensure that $S_1$ and $S_2$ are the same?

$\endgroup$

1 Answer 1

1
$\begingroup$
  1. It depends on the models you have trained.
  2. What you are looking for is a harmonized predictions from different models that is really hard to obtain.
  3. Even this was not your question, but I want to ask you why you need two models to predict the sales?

My solution (to get weekly and monthly sales forecast):

Build 1 model for weekly sales forecast. Derive Monthly sales by using pandas Groupby functions.

monthly_sales_foreast = weekly_sales_forecast.groupby(pd.Grouper(freq='1M')).sum()

or by number of days

monthly_sales_foreast = weekly_sales_forecast.groupby(pd.Grouper(freq='30D')).sum()

In case you are using the same inputs, you can e.g. build a model first for the weekly prediction and change the output layer dimension of model afterwards to obtain monthly forecasts from the same model.

Check out articles about Transfer Learning. I think you will find examples with a global base model and updated different models and additional inputs.

I hope this helos you to get closer to your required solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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