Comments (9)
This was due to bad assumptions on the format of the forecasts
dict. It was assumed that it is a DataFrame with a single columns, named yhat
.
This PR address it. Feel free to take a look, the tests should make it clear what the PR is achieving.
from scikit-hts.
Thanks for the update @carlomazzaferro.
I just want to clarify one thing here. So, according to the updated code, To revise the forecasts we have to pass the DataFrame with one column. Is that right?
from scikit-hts.
And, the same error pops up when using optimal_combination().
Here is the stack trace
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-152-a556a14422e8> in <module>
----> 1 optimal_combination(dict(pred[-4:]), sum_mat = htsmodel.sum_mat, method = 'OLS', mse = {} )
~/.conda/envs/lts/lib/python3.6/site-packages/hts/functions.py in optimal_combination(forecasts, sum_mat, method, mse)
128
129 """
--> 130 hat_mat = y_hat_matrix(forecasts)
131 transpose = np.transpose(sum_mat)
132
~/.conda/envs/lts/lib/python3.6/site-packages/hts/functions.py in y_hat_matrix(forecasts, keys)
89 keys = forecasts.keys()
90 first = list(forecasts.keys())[0]
---> 91 y_hat_mat = np.zeros([len(forecasts[first].yhat), 1])
92 for key in keys:
93 f1 = np.array(forecasts[key].yhat)
~/.conda/envs/lts/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
5137 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5138 return self[name]
-> 5139 return object.__getattribute__(self, name)
5140
5141 def __setattr__(self, name: str, value) -> None:
AttributeError: 'Series' object has no attribute 'yhat'
from scikit-hts.
You should not use optimal_combination
directly. The new function that perform sanitization on the inputs should transform whatever you pass as your forecasts to a format that should work with the revised = revision.revise(forecasts=forecasts, mse=errors, nodes=nodes)
(optimal_combination
gets called by this method).
Now, you should be able to pass as forecasts a dict of strings to either numpy.array
(as long as the array has ndim == 1), pandas.Series
or pandas.DataFrame
(as long as the df has only one column).
But I suggest you to wait till tomorrow, as I'm still working on some further fixes to the convenience methods. You can track the progress here: #68
from scikit-hts.
Hey @carlomazzaferro, your quick response is appreciated. I'll check out #68 for further updates.
from scikit-hts.
Feel free to bump to scikit-hts 0.5.6, see updated convenience docs https://scikit-hts.readthedocs.io/en/latest/hts.html#module-hts.convenience
Thanks for your patience!
from scikit-hts.
Sure @carlomazzaferro. Also, It would be very helpful If you throw some light on #66.
from scikit-hts.
Yes, that is next on my task list and will tackle that together with the related issue about fixing the transforms functionality. Will keep posted when I have a PR in the works
from scikit-hts.
Sure @carlomazzaferro. I Wholeheartedly appreciate all your efforts on this. Thank you so much.
from scikit-hts.
Related Issues (20)
- How to make forecasts strictly positive? HOT 6
- [BUG] Bug with prediction output since 0.5.4 HOT 1
- Still a bug in the current implementation of exogenous variables HOT 8
- [BUG] Probably a bug in how reconciliation works now HOT 2
- [BUG] Possible bug in how a summing matrix is created HOT 2
- [BUG] KeyError when using custom root name HOT 2
- [BUG] Error when forecasting with exogenous regressors for each of the nodes HOT 4
- [BUG] Error installing with pip install scikit-hts[all] HOT 1
- [BUG] Bug report ValueError: Shape of passed values is (249, 150), indices imply (249, 152)
- [BUG] Possible error in computation of WLSV???
- [BUG] After calling fbporphet model.fit(), no forecasts all null
- [DOCS] Documentation
- Pkl file not found error when running fbprophet HOT 1
- Error while fitting data
- [BUG] SarimaxModel fails with to fit with exogenous data
- [FEATURE] Feature request
- [BUG] Bug report - Predicted forecasts frequency not same as training data.
- Zero forecast for middle level time series using optimal reconciliation HOT 2
- [BUG] Iterable abstract class was removed from collections in Python 3.10 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-hts.