https://github.com/nixtla logo
Join Slack
Powered by
# hierarchicalforecast
  • s

    Sarim Zafar

    07/22/2024, 4:45 PM
    Hello, can i use reconciliation if the underlying series have missing timesteps by design, like if it is inactive? Or do I need to fill in the gaps with zeros? However in that case how do I ensure that those timesteps remains equal to zero after the operation?
  • s

    Sarim Zafar

    07/22/2024, 4:49 PM
    Lastly is there a way to use this library on spark?
  • o

    Olivier

    08/15/2024, 8:33 PM
    We just released v0.4.2 of HierarchicaForecast, which adds the following: • Adding sparse TopDown reconciliation methods; • Decreasing the wall-time of existing reconciliation techniques (a.o.
    MinTrace
    techniques and `BottomUp`/
    BottomUpSparse
    ); • Fixing version issues with numpy. Checkout the full release notes here. Happy forecasting!
    🙌 1
  • b

    Brandon Barber

    08/24/2024, 5:58 PM
    I'm receiving this error when trying to run
    hrec.reconcile
    :
    Copy code
    ValueError: 'scipy.sparse.linalg.bicgstab' called with invalid `atol`=legacy; if set, `atol` must be a real, non-negative number.
    Not sure if anybody has encountered before. Any suggestions?
    👀 1
    o
    • 2
    • 2
  • m

    Matias Calderini

    09/02/2024, 11:23 PM
    Hello, I'm trying to apply cross-validation with hierarchical reconciliation, but can't seem to find the best way to do it. Inference is not done often and only for the time-step ahead, so it makes sense to evaluate the model with horizon of 1, many windows and refit to get a sense of the expected performance. I would like to apply a hierarchical reconciliation at each cross-validation window and see if that improves or decreases performance overall. Any suggestions?
    h
    • 2
    • 8
  • m

    Mateo De La Roche

    09/24/2024, 2:35 AM
    Hi quick theoretical question, does it make sense to reconcile series if I have use different model for each of them? for example state was forecasted with autoarima product1 with xgb product2 with random_model
    o
    • 2
    • 2
  • j

    jan rathfelder

    10/01/2024, 3:04 PM
    i have some problems combining multiple models from different levels. error is mainly due to wrong index after aggregation, which breaks reconcile. any code examples available of combining different models, which I can have a look at?
    o
    • 2
    • 3
  • a

    Anthony Giorgio

    10/05/2024, 2:35 PM
    Hi. Does this library support spark (on databricks)? Or there are some best practices on using this library with applyInPandas?
    o
    • 2
    • 2
  • m

    Ml Club

    10/15/2024, 5:42 PM
    #C05CAFHU8TX Hello Nixtla Team, I am trying to do some forecasting,
  • m

    Ml Club

    10/15/2024, 5:43 PM
    Untitled.py
    Untitled.py
    o
    • 2
    • 8
  • m

    Ml Club

    10/15/2024, 5:44 PM
    --------------------------------------------------------------------------- Exception Traceback (most recent call last) Cell In[43], line 11 5 reconcilers = [ 6 BottomUp(), 7 MinTrace(method='mint_shrink'), 8 MinTrace(method='ols') 9 ] 10 hrec = HierarchicalReconciliation(reconcilers=reconcilers) ---> 11 Y_rec_df = hrec.reconcile(Y_hat_df=Y_hat_df, Y_df=Y_fitted_df, S=S_df, tags=tags) File i:\Development\Seer Sight\.venv\Lib\site-packages\hierarchicalforecast\core.py:226, in HierarchicalReconciliation.reconcile(self, Y_hat_df, S, tags, Y_df, level, intervals_method, num_samples, seed, sort_df, is_balanced) 193 """Hierarchical Reconciliation Method. 194 195 The
    reconcile
    method is analogous to SKLearn
    fit_predict
    method, it (...) 222 `Y_tilde_df`: pd.DataFrame, with reconciled predictions. 223 """ 224 # Check input's validity and sort dataframes 225 Y_hat_df, S_df, Y_df, self.model_names = \ --> 226 self._prepare_fit(Y_hat_df=Y_hat_df, 227 S_df=S, 228 Y_df=Y_df, 229 tags=tags, 230 level=level, 231 intervals_method=intervals_method, 232 sort_df=sort_df) 234 # Initialize reconciler arguments 235 reconciler_args = dict( 236 idx_bottom=S_df.index.get_indexer(S.columns), 237 tags={key: S_df.index.get_indexer(val) for key, val in tags.items()} 238 ) File i:\Development\Seer Sight\.venv\Lib\site-packages\hierarchicalforecast\core.py:167, in HierarchicalReconciliation._prepare_fit(self, Y_hat_df, S_df, Y_df, tags, level, intervals_method, sort_df) 165 Y_hat_diff = len(Y_hat_df.index.difference(S_df.index.unique())) 166 if S_diff > 0 or Y_hat_diff > 0: --> 167 raise Exception(f'Check
    S_df
    ,
    Y_hat_df
    series difference, S\Y_hat={S_diff}, Y_hat\S={Y_hat_diff}') 169 if Y_df is not None: 170 # Check Y_hat_df\Y_df series difference 171 Y_diff = len(Y_df.index.difference(uids)) Exception: Check
    S_df
    ,
    Y_hat_df
    series difference, S\Y_hat=5, Y_hat\S=0
  • m

    Ml Club

    10/15/2024, 5:44 PM
    can you please help me with this error
    @Olivier
  • o

    Olivier

    10/21/2024, 3:15 PM
    📣 We just released v0.4.3 of HierarchicaForecast, which adds the following features: • Sparse middle-out reconciliation via
    MiddleOutSparse
    (#281): Efficiently perform middle-out reconciliation in large-scale settings ➕ • Add support for exogenous variables in utils.aggregate (#297): Aggregate exogenous covariates too when aggregating time series 🔥 • Efficient Schafer-Strimmer for MinT (#280): Perform MinT-shrink reconciliation blazingly fast 🚀 • Improve residuals-based reconciliation stability and faster ma.cov (#295): Improved stability and NaN-handling, allowing more problems to be solvable with MinT-methods 💪 Shout out to our community members Christopher Titchen and Kurai Maingi for their contributions! Note that as of v0.4.3, hierarchicalforecast no longer officially supports Python 3.8, which is EOL. Questions or suggestions for new features? Let us know as a comment or file an issue on Github. Our priorities for the next month are (i) adding Polars support and (ii) adding temporal hierarchical reconciliation methods, but open to suggestions otherwise! Happy forecasting!
    🎯 2
    🙌 1
  • j

    jan rathfelder

    10/22/2024, 11:14 AM
    I have a question regarding the need for the fitted values. in our current setup we have models on article level using mlforecast. in mlforecast I can update the data and therefore dont need to re-train so often. but now I might run into an issue if I want to lay a hierarchical model on top of my article level fc, because how do i get my fitted values for the weeks after training where I just update my mlforecast model with most recent data? obviously I could just increase the forecast horizon for my higher level forecasts so reconciliation between the different forecasts is possible, but maybe there is another solution I havent thought about?
    o
    • 2
    • 2
  • m

    Ml Club

    10/24/2024, 10:05 AM
    Hi @Olivier.. for the Hierarchical forecasting, can we use cross validation for evaluation? if possible then can you please show some example like how can we do it?
    o
    • 2
    • 1
  • d

    David Rice

    11/05/2024, 12:11 PM
    Hi, potentially a more theoretical question but here goes. I am forecasting for retail stock replenishment/demand planning. I have a broad assortment with various lead times (so evaluation at SKU level may be over different horizon lengths). However, another consideration is not only the lead time forecast but also the (e.g. end of Season) closing stock position, which is often rolled up to Category (higher agg level). One approach I considered was a hierarchical solution, for example create a long term Category-level forecast (evaluated over the remainder of the Season/longer horizon) that is reconciled with SKU forecasts (evaluated over the lead time). I am not sure if this is possible in HierarchicalForecast, or even a sensible approach? I suspect as a bare minimum, I would need to create a forecast over the long term at SKU level so that it can reconcile effectively with the Category level forecast? I am not against providing SKU forecasts over the longer horizon (i.e. in line with the Category level horizon) but I would like to ensure that they've been evaluated in line with their primary use case. Thanks!
    o
    • 2
    • 4
  • o

    Olivier

    12/16/2024, 7:16 PM
    📣 We just released v1.0.0 of HierarchicaForecast, which adds the following features: • 🐻‍❄️ Polars support (#305). This PR adds Polars support for HierarchicalForecast, and adds an example to the docs. You can now enjoy full compatibility with Polars in HF! • 🙏 Evaluation unified with utilsforecast (#311). We restructured the evaluation functionality in HierarchicalForecast to follow the same API as utilsforecast, further unifying API throughout our libraries. The old evaluation functions will be deprecated in future releases, and documentation has been adapted to show the new behavior. Note that as of v1.0.0, hierarchicalforecast no longer supports the use of
    unique_id
    as index column. Simply put, your input data should always be a flat table without an index. Thanks to MarcoGorelli for helping with Narwhals implementation, which has allowed us to implement Polars swiftly! Questions or suggestions for new features? Let us know as a comment or file an issue on Github. Our priority for the next release is adding temporal hierarchical reconciliation methods, but open to suggestions otherwise! Happy forecasting!
    🙌 1
    b
    a
    +2
    • 5
    • 18
  • j

    jan rathfelder

    01/13/2025, 8:53 PM
    i am running recon but my output only gives the index for the methods and not the forecast values. i guess there is a bug somewhere in my data setup but maybe you guys have a hint what it could be:
    Copy code
    index	ds	y	index/BottomUp	index/TopDown_method-forecast_proportions
    o
    • 2
    • 7
  • j

    Joanna Pineda

    02/03/2025, 4:12 PM
    hi 🙂 I am running reconciliation, and I don't seem to see any changes before and after. Have you seen this before?
    o
    • 2
    • 2
  • j

    jan rathfelder

    02/09/2025, 2:36 PM
    Hi, i am running different methods and sometimes for average_proportions and proportion_averages I only get NaN values. I guess this is related so some kind of short history over many articles or so, but would love to know if there is a systematic rule or so?
    o
    m
    • 3
    • 13
  • p

    pu xu

    02/24/2025, 3:19 AM
    Y_train_df.groupby('unique_id').size() unique_id Australia 72 Australia/ACT 72 Australia/ACT/Business 72 Australia/ACT/Canberra 72 Australia/ACT/Canberra/Business 72 .. Australia/Western Australia/Experience Perth/Other 72 Australia/Western Australia/Experience Perth/Visiting 72 Australia/Western Australia/Holiday 72 Australia/Western Australia/Other 72 Australia/Western Australia/Visiting 72 I'm wondering if the size is different, how to deal with it? for example: the size is 60 60 60 60 60 .. 60 50 12 12 12
    o
    • 2
    • 4
  • b

    Bersu T

    02/24/2025, 4:26 PM
    Hi, how can we do cross-validation to select the best model while also using conformal intervals, specifically in a hierarchical context?
    o
    • 2
    • 12
  • b

    Bersu T

    02/25/2025, 12:12 PM
    Hi, when i try to do a mintshrink or mint wls reconciliation method I get an error. Bottomup and mintols work perfectly fine. Why could this be?
    j
    o
    • 3
    • 16
  • s

    Slackbot

    02/25/2025, 3:31 PM
    This message was deleted.
    o
    • 2
    • 1
  • b

    Bersu T

    02/26/2025, 5:56 PM
    How can we perform autoML per unique id, so not a global one. Is that possible?
    o
    • 2
    • 10
  • n

    Naman Goel

    02/28/2025, 8:34 AM
    Hii, I am trying to use hierarchical forecasting in my sdk. Till now I was only predicting at the lowest level and was making use of clustering also to group the similar time series together. Now if I perform aggregation on my training data and treat the parent time series separately, how to change my clustering logic accordingly. Based on current setup, We perform clustering on panel data to group related time series. Each cluster undergoes hyperparameter tuning to identify the best model for that group. However, introducing hierarchical reconciliation presents a challenge—series at the same level of the hierarchy might end up in different clusters, potentially disrupting the reconciliation process. For example, consider a sales hierarchy where Total Sales is broken down into Region A (Store 1, Store 2) and Region B (Store 3, Store 4). Ideally, reconciliation ensures that the sum of store-level forecasts aligns with their respective regional forecasts and ultimately with total sales. However, clustering might group (Store 1, Store 3) in one cluster and (Store 2, Store 4) in another, even though Store 1 and Store 2 belong to Region A, and Store 3 and Store 4 belong to Region B. This disrupts the natural hierarchical structure and can lead to inconsistencies when reconciling forecasts across levels. I’m seeking guidance on how to ensure reconciliation in such a setup. Any insights would be greatly appreciated!
    o
    • 2
    • 12
  • o

    Olivier

    03/07/2025, 8:13 AM
    📣 We just released v1.1.0 of HierarchicalForecast, which adds the following features: • [FEAT] Add sparse non-negative OLS and WLS via QP for
    MinTraceSparse
    by @christophertitchen in #319 • [FEAT] Implement adjacency matrix by @christophertitchen in #332 • [FEAT] Extremely fast forecast proportions by @christophertitchen in #334 In addition, a number of bugs were fixed: • [FIX] Handle zero division in top down methods by @mattbuot in #325 • [FIX] Raise warning on NaN values when using average proportions and proportion averages methods by @janrth in #335 • [FIX] TopDown method failing on combinations with other methods by @elephaint in #330 • [FIX] ERM-reg and ERM-reg-bu equations by @elephaint in #331 • [FIX] Produce reproducable samples for PERMBU by @elephaint in #337 Thanks to @christophertitchen, @mattbuot and @janrth for their contributions! Questions or suggestions for new features? Let us know as a comment or file an issue on Github. Our next release will add temporal hierarchical reconciliation methods, which is in testing phase. Happy forecasting!
    🙌 1
  • b

    Bersu T

    03/18/2025, 9:45 AM
    I'm using MLForecast with conformal prediction intervals (PredictionIntervals) in cross-validation, which gives me columns: LGBMRegressor, LGBMRegressor-lo-90, LGBMRegressor-hi-90. After reconciliation with BottomUp, I get LGBMRegressor/BottomUp but lose the prediction intervals. How can I get prediction intervals (lo-90, hi-90) for the reconciled BottomUp forecasts in cross-validation?
    j
    o
    • 3
    • 11
  • o

    Olivier

    03/19/2025, 8:29 PM
    📣 We just released v1.2.0 of HierarchicalForecast, which adds the following features: • [FEAT] Cross-temporal reconciliation by @elephaint in #309. This is one of the most requested features in hierarchicalforecast. It extends the library to allow temporal reconciliation, indicating that users can reconcile forecasts that have been created for different frequencies. For example, a weekly forecast can now be reconciled with a daily forecast. Users can now perform cross-sectional, temporal and cross-temporal reconciliation with hierarchicalforecast. Check out the examples! In addition, we fixed the following bugs: • [FIX]: ensure levels are sorted prior to adjacency matrix construction by @christophertitchen in #344 Thanks to @christophertitchen for his contribution! Questions or suggestions for new features? Let us know as a comment or file an issue on Github. Our next priority is horizontal scaling of the reconciliation methods. Happy forecasting!
    🎉 6
  • o

    Olivier

    04/11/2025, 3:31 PM
    📣 We just released v1.2.1 of HierarchicalForecast, which adds the following features: • Support TopDownSparse and MiddleOutSparse for temporal disaggregation by @christophertitchen in #362 In addition, we fixed the following bugs relating to temporal reconciliation: • Remove y requirement from reconcile on temporal aggregation in #356 • Fix TopDown reconciler for temporal reconciliation in #359 Thanks to @christophertitchen for his contribution! Questions or suggestions for new features? Let us know as a comment or file an issue on Github. Our next priority is horizontal scaling of the reconciliation methods. Happy forecasting!
    🙌 1