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

When the lag is greater than the length of the sequence, the calculated statistic is wrong #42

Closed
ilgouli opened this issue Jul 21, 2024 · 2 comments

Comments

@ilgouli
Copy link

ilgouli commented Jul 21, 2024

When the lag is greater than the length of the sequence, the calculated statistic is wrong, which should be null

    from coreforecast.grouped_array import GroupedArray
    from coreforecast.lag_transforms import RollingMean, Lag

    data = np.array([213, 173, 273, 284, 179, 409, 33])
    indptr = np.array([0, 7])
    ga = GroupedArray(data, indptr)

    rolling_lag1 = RollingMean(1, 1, 1)
    rolling_lag2 = RollingMean(2, 1, 1)
    rolling_lag7 = RollingMean(7, 2, 1)
    rolling_lag8 = RollingMean(8, 2, 2)
    print(rolling_lag1.update(ga))
    print(rolling_lag2.update(ga))
    print(rolling_lag7.update(ga))
    print(rolling_lag8.update(ga))

Output

[33.]
[409.]
[213.]
[213.]  # Wrong result
@jmoralez
Copy link
Member

Hey. Which version are you using? I believe this was fixed in 0.0.12

@ilgouli
Copy link
Author

ilgouli commented Jul 24, 2024

Hey. Which version are you using? I believe this was fixed in 0.0.12

I was using version 0.0.7. After upgrading to 0.0.12, the problem is fixed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants