I am looking at the boost::accumulator framework, specifically a couple of the rolling_window calculations.
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/rolling_mean.hpp>
accumulator_set<int, stats<tag::rolling_mean> > acc(tag::rolling_window::window_size = 3);
As you see here, I have set the window_size to be three, such that it is maintaining the mean average of the last three samples only.
Can I amend that size at run-time, perhaps based on a user setting?
If so, and I increase the window_size does the accumulator have extra internal state if it had already seen more than my new window_size, or would I have to wait for the extra values?
The best way to reset a boost accumulator is to assign it to a new one. For example:
typedef accumulator_set<int, ... template crazyness tags ... > window_acc;
window_acc acc;
acc(1);
acc(2);
...
// reset
acc = window_acc();
Actually, swap would be preferred here, but accumulator_set doesn't have a swap member =\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With