-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Add window to exponentially weighted moment functions #11288
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
Comments
Can you clarify with a numerical example? |
In the above I would think of t as present and 0 (or n in my suggestion) as the start. Here is an example
which for the last element is equivalent to doing
What I was wondering was if it is possible to add a window such that there is n exponentially decaying weights and the rest are 0. So for the above data, with n=3 for example, for the last element of the series we would have |
That's very clear @matthewgilbert, thanks. Re the calc, I think you could implement that by taking the difference between two series - one lagged by In terms of the API, I think that could be added, although I'm not sure of the use cases - generally I would use either a rolling OR an exponentially weighted series. Do you have use cases in mind? |
A simple hack to apply this would be
so if there is very little interest from others in this added functionality this is a workaround |
As of version |
But this would be way more efficient to do it in-line. |
Great thanks. Unless I am mistaken, the solution @MaximilianR suggests does not seem that straight forward? My understanding of his suggestion is to solve for which seems to lead to a pretty messy solution? e.g. |
@matthewgilbert gosh, that's certainly not what I envisaged. I actually think your solution is v good. It's not as fast, but I imagine it's fast enough? Otherwise I'm happy to go into my suggestion more, it's really not supposed to be anything like that complicated. |
Yes my application is fairly small amount of data and performance with jreback's proposed solution above works fine. |
Hey @jreback @matthewgilbert, consider closing this issue since mentioned that the proposed solution works for your data sizes? |
Okay I'll go ahead and close this, good call. |
Hi, How about the solution now ? I also meet the same challenge. |
+1 - anything in the pipes for a faster vectorized solution for larger amounts of data? |
+1 - adding window size to ewm() would be nice |
+1 - I'm using the earlier proposed solution, but it's very slow for my use. Is it possible to optimize? |
Seems like using span do approximately the same thing as setting the window. I am not sure, may be anybody can give more concrete information. |
Currently there is no way to specify a rolling window for the exponentially weighted functions. From the docs the weighting function is giving by
However I am wondering if it is straightforward to add a window parameter, similar to the rolling window statistics. This would change the formula to look like
The text was updated successfully, but these errors were encountered: