vangspiliot / AutoTheta

Generalizing the Theta method for automatic forecasting
3 stars 2 forks source link

AutoTheta Library #1

Open StevenVanAken opened 4 years ago

StevenVanAken commented 4 years ago

Hello Mr Spiliotis,

I would like to use your Theta forecast R code you attached and compare it with the "forecTheta" library from Fiorucci, Louzada and Yiqi (2016) - and more specifically the DOTM.

Is your R code available in a library that I could use?

Thanks, Steven

vangspiliot commented 4 years ago

Hi! No, I haven't created a CRAN package for AutoTheta yet. But if you run the functions included in this repository in your console, you'll be able to use them for your experiments.

StevenVanAken commented 4 years ago

Hello Mr Spiliotis,

The code works for the M3 data!

I tried it with my dataset, but I think I’m missing a certain format before I can push it into AutoTheta. I attached the data in csv format.

For a while now, I have been looking for R algorithm that can help me with the following:

  1. Our demand planners get actual sales in both volume and value €
  2. Each demand planner is responsible for a certain business unit in multiple regions
  3. During the demand reviews (S&OP) they have with the sales directors, they select their respective dataset
  4. This dataset has to run through a R algorithm that defines what the best forecast model would be (lowest loss, e.g. MAE)
  5. This statistical forecast is then used as baseline and overrides (i.e. changes) are made by sales wherever they deem it is necessary
  6. This “consensus” forecast is then the unconstrained forecast that is passed to the manufacturing plants so that they can “constrain” it with their available inventory and production capacity
  7. Furthermore, this “constraint” forecast is now a baseline for finance for their reporting

So in a nutshell I’m looking for the model that you (are your colleagues) are trying to develop.

The software I’m developing (in my free time, I’m not an IT guy) is that the demand planner selects a dataset through a front-end and a SQL Server runs this data (see attachment) through an automatic forecasting algorithm in R and returns the best 3 models that the demand planner and sales can select from.

This approach is also considered on page 21, figure 4: ‘MCB significance tests for the combination (Comb) of the AutoTheta, ETS and ARIMA forecasting algorithms, as well as the individual methods.’.

Is the forecast outcome from the AutoTheta a result of a ‘Comb’ of models?

By the way, the dataset in attached file is aggregated by month as it generated by MS Excel. The initial raw data is actually invoiced order lines.

Would be great if you could guide me in using the AutoTheta automatic forecasting algorithm in our demand forecasting process.

Thank you in advance!

Best regards,

Steven

Global S&OP and Demand Planning Manager

Imerys Graphite & Carbon

www.imerys.com

Van: Evangelos Spiliotis notifications@github.com Verzonden: 16 March 2020 07:57 Aan: vangspiliot/AutoTheta AutoTheta@noreply.github.com CC: StevenVanAken vanakensteven001@gmail.com; Author author@noreply.github.com Onderwerp: Re: [vangspiliot/AutoTheta] AutoTheta Library (#1)

Hi! No, I haven't created a CRAN package for AutoTheta yet. But if you run the functions included in this repository in your console, you'll be able to use them for your experiments.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vangspiliot/AutoTheta/issues/1#issuecomment-599373848 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWCGXVYQJ4Y33CFQDL4ALLRHXEULANCNFSM4LLK5X6Q . https://github.com/notifications/beacon/AGWCGXSBAI55I4T3Y2YND2TRHXEULA5CNFSM4LLK5X62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEO43QGA.gif

vangspiliot commented 4 years ago

The format should be a time series R object, so if you work with monthly data, you should provide something like

ts(vector, frequency=12)

to the AutoTheta function. Unfortunately I cannot see your data to help you more with that, but it is quite straightforward to use if you create the vector of the historical observations.

When it come to automatic forecasting, and monthly series, ets() and auto.arima() of the "forecast" package are excellent choices since they examine which is the "best" model for predicting each series per model family and then use it for forecasting. What I do I the paper, is that I provide a similar model selection algorithm for Theta. Then, you can of course combine ets with arima and Theta to get even better results. Equal weights is a good starting point and then the choices are unlimited (cross-validation etc.).

So, the output of AutoTheta is not a result of combination. Is the "best" Theta model can get out of the examined ones. But, as I noted above, you can then easily combine that with ets and arima to get a nice ensemble.

StevenVanAken commented 4 years ago

Thank you Evangelos for the clarification.

In your opinion, what would be the best indicator to select the most appropriate forecast model?

In my Excel prototype I take the 3 months moving average (MAE) as baseline and compare it against the MAE’s of the other available models. The lowest is considered as the preferred one.

For Theta I will use your AutoTheta function. In case of ETS and Auto.Arima I will take the Forecast function as you suggested.

Best regards,

Steven

Van: Evangelos Spiliotis notifications@github.com Verzonden: 19 March 2020 19:07 Aan: vangspiliot/AutoTheta AutoTheta@noreply.github.com CC: StevenVanAken vanakensteven001@gmail.com; Author author@noreply.github.com Onderwerp: Re: [vangspiliot/AutoTheta] AutoTheta Library (#1)

The format should be a time series R object, so if you work with monthly data, you should provide something like

ts(vector, frequency=12)

to the AutoTheta function. Unfortunately I cannot see your data to help you more with that, but it is quite straightforward to use if you create the vector of the historical observations.

When it come to automatic forecasting, and monthly series, ets() and auto.arima() of the "forecast" package are excellent choices since they examine which is the "best" model for predicting each series per model family and then use it for forecasting. What I do I the paper, is that I provide a similar model selection algorithm for Theta. Then, you can of course combine ets with arima and Theta to get even better results. Equal weights is a good starting point and then the choices are unlimited (cross-validation etc.).

So, the output of AutoTheta is not a result of combination. Is the "best" Theta model can get out of the examined ones. But, as I noted above, you can then easily combine that with ets and arima to get a nice ensemble.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vangspiliot/AutoTheta/issues/1#issuecomment-601332573 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWCGXRQP3JAQDX7AH6PPMTRIJNLXANCNFSM4LLK5X6Q . https://github.com/notifications/beacon/AGWCGXSK7LSCRNTQ5NNPB3DRIJNLXA5CNFSM4LLK5X62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEPLZWXI.gif

vangspiliot commented 4 years ago

Sounds good.

Insample evaluations, like the ones you suggest, are easy to build and fast to run. However, you should keep in mind that they might not be representative of the actual forecasting performance of the models.

Maybe use a rolling origin evaluation instead, if your series are long enough to allow for such our sample testing.

Στις Δευ, 23 Μαρ 2020 στις 11:32 π.μ., ο/η StevenVanAken < notifications@github.com> έγραψε:

Thank you Evangelos for the clarification.

In your opinion, what would be the best indicator to select the most appropriate forecast model?

In my Excel prototype I take the 3 months moving average (MAE) as baseline and compare it against the MAE’s of the other available models. The lowest is considered as the preferred one.

For Theta I will use your AutoTheta function. In case of ETS and Auto.Arima I will take the Forecast function as you suggested.

Best regards,

Steven

Van: Evangelos Spiliotis notifications@github.com Verzonden: 19 March 2020 19:07 Aan: vangspiliot/AutoTheta AutoTheta@noreply.github.com CC: StevenVanAken vanakensteven001@gmail.com; Author < author@noreply.github.com> Onderwerp: Re: [vangspiliot/AutoTheta] AutoTheta Library (#1)

The format should be a time series R object, so if you work with monthly data, you should provide something like

ts(vector, frequency=12)

to the AutoTheta function. Unfortunately I cannot see your data to help you more with that, but it is quite straightforward to use if you create the vector of the historical observations.

When it come to automatic forecasting, and monthly series, ets() and auto.arima() of the "forecast" package are excellent choices since they examine which is the "best" model for predicting each series per model family and then use it for forecasting. What I do I the paper, is that I provide a similar model selection algorithm for Theta. Then, you can of course combine ets with arima and Theta to get even better results. Equal weights is a good starting point and then the choices are unlimited (cross-validation etc.).

So, the output of AutoTheta is not a result of combination. Is the "best" Theta model can get out of the examined ones. But, as I noted above, you can then easily combine that with ets and arima to get a nice ensemble.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/vangspiliot/AutoTheta/issues/1#issuecomment-601332573> , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AGWCGXRQP3JAQDX7AH6PPMTRIJNLXANCNFSM4LLK5X6Q> . < https://github.com/notifications/beacon/AGWCGXSK7LSCRNTQ5NNPB3DRIJNLXA5CNFSM4LLK5X62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEPLZWXI.gif>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vangspiliot/AutoTheta/issues/1#issuecomment-602481585, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWWAVAXMFWTDS7EOSTWOSDRI4UBDANCNFSM4LLK5X6Q .

-- Dr. Evangelos Spiliotis Research Fellow Forecasting & Strategy Unit School of Electrical and Computer Engineering National Technical University of Athens

work:+30 210 7723637