使用boost :: accumulators对值之间的增量进行采样

Ale*_*x B 5 c++ boost

我有一个包含N个样本的数据集(比如说,13,16,17,20),其中每个下一个样本都会增加一些值(在这种情况下为3,1,3),我想找到第二个序列的各种统计数据.

样本是以递增方式收集的时间戳(即并非所有样本都可以一次获得),因此我想使用boost::accumulators::accumulator_set它看起来像适合账单的东西.

我希望能够做到这样的事情:

accumulator_set< double, features< tag::mean > > acc;
...
acc(13);
acc(16);
acc(17);
acc(20);
Run Code Online (Sandbox Code Playgroud)

... 但是采样差异而不是实际值.

如何在accumulator_set不手动跟踪最后一个值的情况下执行此操作?

Inv*_*rse 3

升压累加器没有差异统计。不过你可以自己推出:

http://www.boost.org/doc/libs/1_37_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_accumulators_framework.extending_the_accumulators_framework

我认为最好的解决方案就是跟踪最后的增值。