accumulators::histogram

I see accumulators::density is almost what I want. I need a histogram, but it want to specify in advance the number of bins and the bin size. This is really a simplified accumulators::density. I think it would be good to add this to accumulators::density.

Neal Becker wrote:
I see accumulators::density is almost what I want. I need a histogram, but it want to specify in advance the number of bins and the bin size. This is really a simplified accumulators::density.
I think it would be good to add this to accumulators::density.
Do these help? tag::density::cache_size Number of first samples used to determine min and max. tag::density::num_bins Number of bins (two additional bins collect under- and overflow samples). They are named parameters that you can specify to an accumulator_set's constructor. accumulator_set<double, features<tag::density> > acc( tag::density::cache_size = 10 tag::density::num_bins = 20 ); HTH, -- Eric Niebler Boost Consulting www.boost-consulting.com

Eric Niebler wrote:
Neal Becker wrote:
I see accumulators::density is almost what I want. I need a histogram, but it want to specify in advance the number of bins and the bin size. This is really a simplified accumulators::density.
I think it would be good to add this to accumulators::density.
Do these help?
tag::density::cache_size Number of first samples used to determine min and max.
tag::density::num_bins Number of bins (two additional bins collect under- and overflow samples).
They are named parameters that you can specify to an accumulator_set's constructor.
accumulator_set<double, features<tag::density> > acc( tag::density::cache_size = 10 tag::density::num_bins = 20 );
HTH,
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need. Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it?

On 30 Jan 2008, at 08:26, Neal Becker wrote:
Eric Niebler wrote:
Neal Becker wrote:
I see accumulators::density is almost what I want. I need a histogram, but it want to specify in advance the number of bins and the bin size. This is really a simplified accumulators::density.
I think it would be good to add this to accumulators::density.
Do these help?
tag::density::cache_size Number of first samples used to determine min and max.
tag::density::num_bins Number of bins (two additional bins collect under- and overflow samples).
They are named parameters that you can specify to an accumulator_set's constructor.
accumulator_set<double, features<tag::density> > acc( tag::density::cache_size = 10 tag::density::num_bins = 20 );
HTH,
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need.
Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it?
It would indeed be nice to be able to explicitly specify the min and max for the bins and I guess that should not be too hard to do. Eric, what do you think? Matthias

Matthias Troyer wrote:
On 30 Jan 2008, at 08:26, Neal Becker wrote:
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need.
Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it?
It would indeed be nice to be able to explicitly specify the min and max for the bins and I guess that should not be too hard to do. Eric, what do you think?
Sounds reasonable. I'm super-busy at the moment getting proto ready for its upcoming review. I can add this to the list, or someone (Neal?) can submit a patch which I would gladly accept. -- Eric Niebler Boost Consulting www.boost-consulting.com

Eric Niebler wrote:
Matthias Troyer wrote:
On 30 Jan 2008, at 08:26, Neal Becker wrote:
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need.
Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it?
It would indeed be nice to be able to explicitly specify the min and max for the bins and I guess that should not be too hard to do. Eric, what do you think?
Sounds reasonable. I'm super-busy at the moment getting proto ready for its upcoming review. I can add this to the list, or someone (Neal?) can submit a patch which I would gladly accept.
I haven't gotten it working - I haven't learned about boost::parameter yet. Someone familiar with that could probably finish this quickly. Here is what I have so far:

Neal Becker wrote:
Eric Niebler wrote:
Matthias Troyer wrote:
On 30 Jan 2008, at 08:26, Neal Becker wrote:
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need.
Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it? It would indeed be nice to be able to explicitly specify the min and max for the bins and I guess that should not be too hard to do. Eric, what do you think? Sounds reasonable. I'm super-busy at the moment getting proto ready for its upcoming review. I can add this to the list, or someone (Neal?) can submit a patch which I would gladly accept.
I haven't gotten it working - I haven't learned about boost::parameter yet. Someone familiar with that could probably finish this quickly. Here is what I have so far: <snip>
I took Matthias' suggestion above to mean he thought the density accumulator could be given additional "min" and "max" constructor parameters, not that we need a whole new accumulator. Matthias, was that what you were suggesting? I'd rather go that route. -- Eric Niebler Boost Consulting www.boost-consulting.com

On 31 Jan 2008, at 08:15, Eric Niebler wrote:
Neal Becker wrote:
Eric Niebler wrote:
Matthias Troyer wrote:
On 30 Jan 2008, at 08:26, Neal Becker wrote:
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need.
Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it? It would indeed be nice to be able to explicitly specify the min and max for the bins and I guess that should not be too hard to do. Eric, what do you think? Sounds reasonable. I'm super-busy at the moment getting proto ready for its upcoming review. I can add this to the list, or someone (Neal?) can submit a patch which I would gladly accept.
I haven't gotten it working - I haven't learned about boost::parameter yet. Someone familiar with that could probably finish this quickly. Here is what I have so far: <snip>
I took Matthias' suggestion above to mean he thought the density accumulator could be given additional "min" and "max" constructor parameters, not that we need a whole new accumulator. Matthias, was that what you were suggesting? I'd rather go that route.
Yes, that was my suggestion. Or we could implement the current one based on the simpler one. Matthias

On Wednesday 30 January 2008, Neal Becker wrote:
I don't think that helps. How can I specify apriori the number of bins and the min and max? AFAICT, the above would let me do this by forcing in some fake data, that has the effect of filling the cache and thus setting num_bins, min, max, but is has the side effect of causing that data to effect the histogram - which is not what I need.
Unless I misunderstand, we need another (simpler) class "histogram" that implements just this simpler behavior. Perhaps density could be build on top of it?
Hello, It happens that I needed a similar solution. I didn't have much time and am not an expert in mpl, but I've created a rough hack from density.hpp that seems to work... And I think that this is a very useful feature, because otherwise I would have to do the hack with setting the cache to 2 and injecting 2 dummy samples with the bounds... Sending again, as during the night I sent from the wrong address and got a bounce. Milosz
participants (4)
-
Eric Niebler
-
Matthias Troyer
-
Milosz Marian Hulboj
-
Neal Becker