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

Moving averages for reports using cycle-time / percent_of #4

Open
leopd opened this issue Oct 23, 2019 · 3 comments
Open

Moving averages for reports using cycle-time / percent_of #4

leopd opened this issue Oct 23, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@leopd
Copy link
Owner

leopd commented Oct 23, 2019

Currently the averages in the report are counted from the beginning of the program, without exception. This can be a problem if you're watching a process whose behavior is changing. Instead, the report could calculate the average over recent data only, and thus reflect changes in behavior much more quickly by only summarizing recent behavior.

Two common ways to do this would be an exponential moving average (EMA) algorithm, or a sliding window (SW). EMA is computationally simple, and thus would be my choice, but it's harder to explain and understand. SW literally just averages over the last N events instead of back to the beginning of the program. SW is much easier to understand, but requires a lot more computational overhead. SW also has some undesirable "ringing" properties in how it responds to periodically changing behavior whereas EMA does a better job of averaging those out.

The simplest (for the user) thing I can think of would be to switch to EMA after some number of cycles. Default to 100 say, but configurable like timebugdet.ema_after = 10 if you want to see behavior changes reflected more quickly.

@leopd leopd added the enhancement New feature or request label Oct 23, 2019
@floringogianu
Copy link

floringogianu commented Oct 29, 2019

Another option would maybe be to reset the timer whenever timebudget.report(reset=True) is called? And simply report the sliding window in-between calls?

Edit: sorry, I only saw #5 opened only after I commented.

@leopd
Copy link
Owner Author

leopd commented Oct 29, 2019

I like the suggestion of including reset as an option to report. This is very simple to understand.

@leopd
Copy link
Owner Author

leopd commented Oct 30, 2019

I took the suggestion from @floringogianu in 38752f3 and added a reset option to report.

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

No branches or pull requests

2 participants