Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Possible error in computation of WLSV??? #84

Open
jiahao87 opened this issue Oct 25, 2021 · 0 comments
Open

[BUG] Possible error in computation of WLSV??? #84

jiahao87 opened this issue Oct 25, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@jiahao87
Copy link

jiahao87 commented Oct 25, 2021

Describe the bug
The diagonal matrix for the WLSV method currently is computed by the code below under hts.functions.optimal_combination function:

elif method == MethodT.WLSV.name:
    diag = [mse[key] for key in mse.keys()]
    diag = np.diag(np.flip(np.hstack(diag) + 0.0000001, 0))

Is there a reason for the np.flip? I am assuming that the mse.keys() are in the same order as the forecasts parameter to hts.functions.optimal_combination function. By flipping the array, the base forecast errors will be presented in the diagonal matrix in a reverse order.

Example:

>>> mse = {'total': 10, 'subtotal1': 5, 'subtotal2': 3}

>>> diag = [mse[key] for key in mse.keys()]

>>> diag = np.diag(np.flip(np.hstack(diag) + 0.0000001, 0))

>>> diag
array([[ 3.0000001,  0.       ,  0.       ],
       [ 0.       ,  5.0000001,  0.       ],
       [ 0.       ,  0.       , 10.0000001]])

However, referring to the formula here, I am expecting diagonal matrix to be:

array([[ 10.0000001,  0.       ,  0.       ],
       [ 0.       ,  5.0000001,  0.       ],
       [ 0.       ,  0.       , 3.0000001]])

To Reproduce
Steps to reproduce the behavior

Please see example above.

Expected behavior
A clear and concise description of what you expected to happen.

Please see example above.

Desktop (please complete the following information):

  • OS: Windows10
  • scikit-hts version: 0.5.12
  • Python version: 3.7

Additional context
Add any other context about the problem here.

Much appreciation for any clarification and your patience if I misunderstood something. Thank you for your great work here.

@jiahao87 jiahao87 added the bug Something isn't working label Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant