TWINCY ZATAKIA
06/18/2023, 4:16 PMHarshita Ved
06/19/2023, 7:09 PMKin Gtz. Olivares
06/20/2023, 1:02 AMY_hat_df
's observations are not a multiple of your base predictions.Jeff Tackes
06/20/2023, 2:28 AMIsaac
06/21/2023, 2:24 PMHarshita Ved
06/22/2023, 3:41 PMreconciled_forecasts = hrec.reconcile(Y_hat_df=Y_hat_df, Y_df=hts_orders_agg, S=hts_S_orders, tags=hts_orders_tags)
Error:
Exception: Check `S_df`, `Y_hat_df` series difference, S\Y_hat=50, Y_hat\S=0
I also tried passing the same df in Y_hat_df
and Y_df
just to ensure the tags are exactly the same. Apparently it always gives a mismatch error. I created tags on overall dataset and afterwards splitted in train-test just like examples in the package.
Unable to move forward. Has anyone faced the same issue and know solution?Jack Solomon
07/29/2023, 12:32 AMNasreddine D
07/31/2023, 6:18 PMAda PuĆlecka
08/25/2023, 11:10 AMChad Parmet
09/15/2023, 1:25 PMHierarchicalForecast
allow for variable length time series, or does it assume that all of the time series/levels have complete data for the the full maximum time frame in the dataset?
For example say I have a hierarchical dataset with sales by store, nested into countries, over the past 12 months at max. Does HF assume every time series will have 12 complete months of data? Or does it handle appropriately a dataset where one time series (store) has only 3 months of data, one of the countries may have only 6 months etc?
I'm not getting errors when I run this kind of dataset, but I'm not sure if it explains why results are unexpected
Thank you!Jemima Graham
09/19/2023, 9:27 AMJason Gofford
10/13/2023, 4:01 PMTypeError: unhashable type: 'set'
error when calling reconcile
? Full stack trace in thread.Jason Gofford
10/14/2023, 8:27 PMaggregate
from returning 0 valued series for missing hierarchy combinations? As an example, if I have two countries, let's say France and Germany, I will have items sold in France but not German. From a conceptual perspective it doesn't make sense to have series corresponding to French items in the German market (even if they're 0) as they don't exist. As it stands the aggregate
function is causing a 20x explosion in rowcount in my dataset, mostly due to 0 sum series of missing combinationsFrancisco
10/17/2023, 3:30 AMJason Gofford
10/18/2023, 1:22 PMY_test_df
because their length is lower than my horizon? At the moment, if I use aggregate
to create the hierarchy I end up in a "series differences" scenario because my S_df
has levels that do not exist in Y_train_df
(as they're only in Y_test_df
). I can filter S_df
to only include what's in Y_train_df
but then I think I lose the ability to extract the test-set forecasts for those shorter series. Is there a better way?Francisco
11/07/2023, 1:34 PMFrancisco
11/07/2023, 1:34 PMC:\Users\M330618\.conda\envs\Merck\lib\site-packages\hierarchicalforecast\methods.py:261: RuntimeWarning:
invalid value encountered in divide
C:\Users\M330618\.conda\envs\Merck\lib\site-packages\hierarchicalforecast\methods.py:687: UserWarning:
Replacing negative forecasts with zero.
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
Cell In[544], line 19
16 rec_model = HierarchicalReconciliation(reconcilers=reconcilers)
18 #crear matriz de reconciliaciĂłn
---> 19 p_rec = rec_model.reconcile(Y_hat_df=forecast_agg, Y_df=train_agg, S=S_train, tags=tags)
File ~\.conda\envs\Merck\lib\site-packages\hierarchicalforecast\core.py:265, in HierarchicalReconciliation.reconcile(self, Y_hat_df, S, tags, Y_df, level, intervals_method, num_samples, seed, sort_df)
261 fcsts_model = reconciler.predict(S=reconciler_args['S'],
262 y_hat=reconciler_args['y_hat'], level=level)
263 else:
264 # Memory efficient reconciler's fit_predict
--> 265 fcsts_model = reconcile_fn(**kwargs, level=level)
267 # Parse final outputs
268 Y_tilde_df[recmodel_name] = fcsts_model['mean'].flatten()
File ~\.conda\envs\Merck\lib\site-packages\hierarchicalforecast\methods.py:761, in MinTrace.fit_predict(self, S, y_hat, idx_bottom, y_insample, y_hat_insample, sigmah, level, intervals_method, num_samples, seed, tags)
758 raise Exception('idx_bottom needed for nonnegative reconciliation')
760 # Fit creates P, W and sampler attributes
--> 761 self.fit(S=S,
762 y_hat=y_hat,
763 y_insample=y_insample,
764 y_hat_insample=y_hat_insample,
765 sigmah=sigmah,
766 intervals_method=intervals_method,
767 num_samples=num_samples,
768 seed=seed,
769 tags=tags, idx_bottom=idx_bottom)
771 return self._reconcile(S=S, P=self.P, y_hat=self.y_hat,
772 level=level, sampler=self.sampler)
File ~\.conda\envs\Merck\lib\site-packages\hierarchicalforecast\methods.py:706, in MinTrace.fit(self, S, y_hat, y_insample, y_hat_insample, sigmah, intervals_method, num_samples, seed, tags, idx_bottom)
703 bottom_fcts = np.apply_along_axis(lambda y_hat: solve_qp(G=G, a=a @ y_hat, C=C, b=b)[0],
704 axis=0, arr=y_hat)
705 if not np.all(bottom_fcts > -1e-8):
--> 706 raise Exception('nonnegative optimization failed')
707 # remove negative values close to zero
708 bottom_fcts = np.clip(np.float32(bottom_fcts), a_min=0, a_max=None)
Exception: nonnegative optimization failed
Francisco
11/07/2023, 1:35 PMFrancisco
11/07/2023, 1:37 PMYacoub Alatrash
11/09/2023, 8:14 PMYacoub Alatrash
11/10/2023, 7:36 PMToni Borders
11/14/2023, 4:54 PMTraceback (most recent call last):
File â/Users/tmb/PycharmProjects/data-science/UFE/code/hierarchFrcstEx.pyâ, line 14, in <module>
from hierarchicalforecast.methods import BottomUp, TopDown, MiddleOut
File â/Users/tmb/Library/Caches/pypoetry/virtualenvs/data-science-zw503lJq-py3.10/lib/python3.10/site-packages/hierarchicalforecast/methods.pyâ, line 14, in <module>
_from quadprog import solve_qp_
_ImportError: dlopen(/Users/tmb/Library/Caches/pypoetry/virtualenvs/data-science-zw503lJq-py3.10/lib/python3.10/site-packages/quadprog.cpython-310-darwin.so, 0x0002): tried: â/Users/tmb/Library/Caches/pypoetry/virtualenvs/data-science-zw503lJq-py3.10/lib/python3.10/site-packages/quadprog.cpython-310-darwin.soâ (mach-o file, but is an incompatible architecture (have âx86_64â, need âarm64â)), â/System/Volumes/Preboot/Cryptexes/OS/Users/tmb/Library/Caches/pypoetry/virtualenvs/data-science-zw503lJq-py3.10/lib/python3.10/site-packages/quadprog.cpython-310-darwin.soâ (no such file), â/Users/tmb/Library/Caches/pypoetry/virtualenvs/data-science-zw503lJq-py3.10/lib/python3.10/site-packages/quadprog.cpython-310-darwin.soâ (mach-o file, but is an incompatible architecture (have âx86_64â, need âarm64â))_
Toni Borders
11/21/2023, 12:07 PMTraceback (most recent call last):
File â/Users/tmb/PycharmProjects/data-science/UFE/code/hierFcst.pyâ, line 106, in <module>
_main(data, freq, metadata_str, account)_
File â/Users/tmb/PycharmProjects/data-science/UFE/code/hierFcst.pyâ, line 88, in main
_Y_df = aggregate(Y_df, spec)_
File â/Users/tmb/PycharmProjects/data-science/UFE/code/hierFcst.pyâ, line 81, in aggregate
_Y_df, S_df, tags = aggregate(Y_df, spec)_
File â/Users/tmb/PycharmProjects/data-science/UFE/code/hierFcst.pyâ, line 81, in aggregate
_Y_df, S_df, tags = aggregate(Y_df, spec)_
File â/Users/tmb/PycharmProjects/data-science/UFE/code/hierFcst.pyâ, line 81, in aggregate
_Y_df, S_df, tags = aggregate(Y_df, spec)_
[Previous line repeated 995 more times]
RecursionError: maximum recursion depth exceededHere is my code:
def get_spec():
spec = [
['org'],
['org', 'account'],
['org','meter'],
['org','account','meter']
]
return spec
def aggregate(Y_df, spec):
Y_df, S_df, tags = aggregate(Y_df, spec)
Y_df = Y_df.reset_index()
def main(data):
Y_df = clean_data(data)
spec = get_spec()
Y_df = aggregate(Y_df, spec)
print(Y_df.head(20))
Any thoughts on what could be going wrong?Graeme Davidson
11/22/2023, 4:28 PMA
11/25/2023, 4:24 PM