JoaquinAmatRodrigo / skforecast

Time series forecasting with machine learning models
https://skforecast.org
BSD 3-Clause "New" or "Revised" License
996 stars 113 forks source link

Series-specifc exogenous vars for ForecasterAutoregMultiSeries #646

Closed sharmuz closed 1 month ago

sharmuz commented 4 months ago

Hi Joaquin, Javier,

First of - great package! The user guides + diagrams are especially top notch 👌

Regarding my question - currently for multi-series forecasters any provided exog vars are replicated for each series. You mentioned that series-specific exog is a feature that's on your backlog - glad to hear!

However, I'm keen to implement this myself sooner :-) Is it "simply" a case of editing create_train_X_y() in ForecasterAutoregMultiSeries.py to make the necessary transformations?

For example, if, like in the user guide, I am predicting future sales of 3 products then it will be 3-series. But if in addition I know whether each of the items were on a promotion for each time period then I have a series-specific exog. The goal would then be to have my training data look like this:

|    |   lag_1 |   lag_2 |   sales_product_a |   sales_product_b |   sales_product_c |   on_promotion |
|----|---------|---------|-------------------|-------------------|-------------------|----------------|
|  0 |     110 |     100 |                 1 |                 0 |                 0 |              1 |
|  1 |      75 |      90 |                 0 |                 1 |                 0 |              1 |
|  2 |      10 |      50 |                 0 |                 0 |                 1 |              0 |

Or would you suggest a different approach?

JavierEscobarOrtiz commented 4 months ago

Hello @sharmuz,

Thanks for opening the issue. Yes, we are working on it and hope to have a final version in the next few weeks. 😄

Regarding your question, yes. This is the way we are editing create_train_X_y as well.

This feature will come in skforecast 0.12.x. Love to see that the community is waiting for it!

Thanks

Javi

JavierEscobarOrtiz commented 1 month ago

Hello @sharmuz ,

The functionality to include series-specific exogenous variables in ForecasterMultiSeries is now available in skforecast 0.12.0:

https://skforecast.org/latest/user_guides/multi-series-with-different-length-and-different_exog

Hope it helps!