-
Notifications
You must be signed in to change notification settings - Fork 727
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
statistics: abstract MovingAvg (rolling statistics) interface #1843
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// MedianFilter works as a median filter with specified window size. | ||
// There are at most `size` data points for calculating. | ||
// References: https://en.wikipedia.org/wiki/Median_filter. | ||
type MedianFilter struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would we add other MovingAvg
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #1843 +/- ##
==========================================
+ Coverage 78.02% 78.04% +0.01%
==========================================
Files 168 168
Lines 17004 17009 +5
==========================================
+ Hits 13267 13274 +7
+ Misses 2649 2645 -4
- Partials 1088 1090 +2
Continue to review full report at Codecov.
|
What problem does this PR solve?
There is a
RollingStats
struct which is actually used to calculate moving average. The new hotspot scheduler will use similar structs to denoise or estimate the cluster status, so it useful to abstract an interface for it.What is changed and how it works?
Add an interface:
MovingAvg
. It provides the basic methods:Add()
andGet()
, and two function may be useful in test:Reset()
andSet()
.Rename the
RollingStats
toMedianFilter
and modify it to satisfyMovingAvg
.Check List
Tests