mimir
mimir copied to clipboard
Add warmup counter to EWMA rate
What this PR does
Adds a warm-up period to the EWMA rate so that the rate for the first N samples is returned as 0. The approach mirrors the approach in VividCortex, although there the recommendation is to initialize the moving rate as the mean of the first 60 samples.
Which issue(s) this PR fixes or relates to
Fixes #5443
Checklist
- [X] Tests updated.
- [ ] Documentation added.
- [ ]
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. - [ ]
about-versioning.mdupdated with experimental features.
@jhalterman I took a shot at #5443 and the implementation is in between the VividCortex approach (with a counter) and the current approach with using the sliding window time. This returns 0 during the first 9 ticks, whereas the sliding window time does that for the first 60s.
I amended the existing test for math.EWMARate to expect 0 for the first 9 samples, but I suspect that there other tests that will fail as a result of this change.
Amended the warm-up sample count to be 60 so it's aligned with the sliding window time of 60s.
Hi @slimjim777 Thanks for the PR and apologies for the delay!
My main question is, can we make the warmup size configurable? We could create an EWMA with warmup via something like NewEWMARateWithWarmup.
My main question is, can we make the warmup size configurable? We could create an EWMA with warmup via something like
NewEWMARateWithWarmup.
I’ll add that
Hi @slimjim777 Thanks for the PR and apologies for the delay!
My main question is, can we make the warmup size configurable? We could create an EWMA with warmup via something like
NewEWMARateWithWarmup.
I've added a NewEWMARateWithWarmup method.
(It could have been done with adding the functional options approach or a builder pattern, but I kept it as a separate constructor)
Thank you for your contribution. This pull request has been marked as stale because it has had no activity in the last 150 days. It will be closed in 30 days if there is no further activity. If you need more time, you can add a comment to the PR.
This pull request has been closed because it has been stale for 30 days with no activity. Feel free to reopen if you want to continue working on this.