[accumulators] density: empty values

I have the following program:
#include <iostream>
#include

Robert Kubrick wrote:
I have the following program:
<snip>
Bin values and indexes don't seem to be initialized:
$ acc_dist Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0
I'm afraid I don't have time to investigate this right now. Please file a bug at https://svn.boost.org/trac/boost/ and be sure to state what you think the expected results should be. Thanks. -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
Robert Kubrick wrote:
I have the following program:
<snip>
Bin values and indexes don't seem to be initialized:
$ acc_dist Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0
I'm afraid I don't have time to investigate this right now. Please file a bug at https://svn.boost.org/trac/boost/ and be sure to state what you think the expected results should be. Thanks.
Addendum: if the number of samples is at least as great as the cache size, then it seems to work. I didn't actually write the density accumulator, so I'll need to check with the author to see if that's a precondition, or if there's some way we can return meaningful results with fewer samples. Matthias? Still, a bug report would be good. -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler
Eric Niebler wrote:
Robert Kubrick wrote:
I have the following program:
<snip>
Bin values and indexes don't seem to be initialized:
$ acc_dist Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0 Bin lower bound: 0, Value: 0
I'm afraid I don't have time to investigate this right now. Please file a bug at https://svn.boost.org/trac/boost/ and be sure to state what you think the expected results should be. Thanks.
Addendum: if the number of samples is at least as great as the cache size, then it seems to work. I didn't actually write the density accumulator, so I'll need to check with the author to see if that's a precondition, or if there's some way we can return meaningful results with fewer samples. Matthias?
Still, a bug report would be good.
I changed the number of samples to 10, matching the original cache_size parameter. It works better: Bin lower bound: -0.445, Value: 0 Bin lower bound: 0.1, Value: 0.1 Bin lower bound: 0.645, Value: 0 Bin lower bound: 1.19, Value: 0.1 Bin lower bound: 1.735, Value: 0 Bin lower bound: 2.28, Value: 0.1 Bin lower bound: 2.825, Value: 0 Bin lower bound: 3.37, Value: 0.1 Bin lower bound: 3.915, Value: 0 Bin lower bound: 4.46, Value: 0.1 Bin lower bound: 5.005, Value: 0.3 Bin lower bound: 5.55, Value: 0 Bin lower bound: 6.095, Value: 0 Bin lower bound: 6.64, Value: 0 Bin lower bound: 7.185, Value: 0 Bin lower bound: 7.73, Value: 0 Bin lower bound: 8.275, Value: 0 Bin lower bound: 8.82, Value: 0 Bin lower bound: 9.365, Value: 0 Bin lower bound: 9.91, Value: 0.1 Bin lower bound: 10.455, Value: 0 Bin lower bound: 11, Value: 0.1 A couple of questions: 1) I have a real-time application that keeps track of some statistics based on the events received so the values can not be pre-determined. Statistics are reset by the application at regular time intervals. What happens if I leave the cache_size parameter to 1 and then keep adding samples? Is there a serious performance penalty? 2) Is there a way to reset the acc object in the example? Or do I have to deallocate the object and instantiate a new one to generate a new sampling?

Robert Kubrick wrote:
A couple of questions:
1) I have a real-time application that keeps track of some statistics based on the events received so the values can not be pre-determined. Statistics are reset by the application at regular time intervals. What happens if I leave the cache_size parameter to 1 and then keep adding samples? Is there a serious performance penalty?
I mentioned that I didn't write the density accumulator. I don't have an answer for you. CC'ing Matthias.
2) Is there a way to reset the acc object in the example? Or do I have to deallocate the object and instantiate a new one to generate a new sampling?
This is a frequently requested feature, so I just created a ticket for it: https://svn.boost.org/trac/boost/ticket/3040 -- Eric Niebler BoostPro Computing http://www.boostpro.com

Hi Robert, Robert Kubrick schrieb:
I changed the number of samples to 10, matching the original cache_size parameter. It works better:
first the behaviour of the density feature is not a bug. If you set the cache_size=10, then the first 10 samples will be used to determine the bin lower bound. That is, it first extracts the min and max from the first 10 samples, after that it creates the bin_positions according to this rule: bin_positions[i]=minimum + (i - 1.) * (maximum - minimum)/num_bins. After this procedure the calculation of the statistics begins. That's why the bin values and indexes are not initialized when sample size is smaller then the cache_size.
A couple of questions:
1) I have a real-time application that keeps track of some statistics based on the events received so the values can not be pre-determined. Statistics are reset by the application at regular time intervals. What happens if I leave the cache_size parameter to 1 Leaving the cache_size to one doesnt make sense, because min=max and bin_positions will all be the same. I suggest you to leave cache_size to two and create two artificial values acc(min=your choice) and acc(max=your choice). This wont have any statistical impact, if your sample size is large>100 enough. and then keep adding samples? Is there a serious performance penalty?
No there is no serious performance penalty.
2) Is there a way to reset the acc object in the example? What do you mean by that? Do you want to set the statistics to zero? Then you need definitely to deallocate the object and instantiate a new one.
Or do I have to deallocate the object and instantiate a new one to generate a new sampling Best regards, Kim
participants (3)
-
Eric Niebler
-
Kim Kuen Tang
-
Robert Kubrick