-
Notifications
You must be signed in to change notification settings - Fork 6
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
Online algorithm and increasing exponential weights #23
Comments
Thanks for the report. Looks like the second issue is related to floating point arithmetic, which is (unfortunately) because online algorithms are prone to the loss of precision due to round-off errors. The issue is magnified when both the window is rolling (because observations are subtracted) and the exponential weights are increasing, like you have demonstrated. In terms of solutions, if both of these conditions are met then I think it would make sense for the Also, the first issue is an overlook on my part and will be resolved, i.e. when weights are something like |
I will agree that the way to go is to throw a warning and revert to offline algorithm when (1) we pass rolling weights which grow exponentially and (2) the Here is a table which shows on which weighting scheme the online or offine algorithm is available:
Looking at this table, this question comes naturally: Why the |
I believe online has a smaller time complexity, and it makes sense to offer faster method as the default one |
Thanks for the report. I have fixed the issue in the development version:
I agree with @jangorecki and also my sense is that most users don’t change the default |
Thank you for your prompt response on this issue. I confirm now that the issues have been resolved on the dev. version. Feel free to close it. |
Issue description
We don’t get the expected results when
online = TRUE
and theweights
is a vector of increasing exponential weights, i.e., within the sliding
window the most recent observation has the smallest weight and the
oldest the highest weight (grows exponentially as we go further back in time).
Minimal example:
When switching to off-line it works as expected:
The above examples might be considered corner case because of the
selected weights.
So let’s consider the following example that it seems to work as
expected:
The above examples are equal, although not identical. In addition, we
used a vector of length 5. So let’s re-run the above examples by
increasing the input size.
By increasing the vector size to 200, the online version didn’t give the
expected result. To get an idea of the different results between online
and offine compare the following:
tail(res.offline)
tail(res.online)
For completeness, for arbitrary weights the algorithim switches to
offline mode and throws a warning:
Multiple Test Scenarios
To investigate further, I have created a custom test function to check
the output from base vs roll-online vs roll-offline for sum function.
The custom function accepts two input vectors and has the option to
reverse the weights.
Test inputs:
Case: Decreasing Exponential Weights
Takeaways:
Case: Increasing Exponential Weights
Similar test cases as above with their weights reversed.
Takeaways:
i.e,
0.5 ^ (3:0)
orrev(0.5 ^ (3:0))
will give the same resultunder online or offline.
The text was updated successfully, but these errors were encountered: