Skip to content

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

@jiahao87

Description

@jiahao87

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions