Boost C++ Libraries: Ticket #3038: [accumulators] Empty histogram https://svn.boost.org/trac10/ticket/3038 <p> When the number of samples entered is lower than the cache_size parameter, histogram is not initialized. Example: </p> <p> </p> <pre class="wiki"> typedef iterator_range&lt;std::vector&lt;std::pair&lt;double, double&gt; &gt;::iterator &gt; histogram_type; accumulator_set&lt;double, features&lt;tag::density&gt; &gt; acc(tag::density::num_bins = 20, tag::density::cache_size = 10); // push in some data ... acc(0.1); acc(1.2); acc(2.3); acc(3.4); acc(4.5); acc(5.4); acc(5.5); // Display the results ... histogram_type hist = density(acc); for( int i = 0; i &lt; hist.size(); i++ ) std::cout &lt;&lt; "Bin lower bound: " &lt;&lt; hist[i].first &lt;&lt; ", Value: " &lt;&lt; hist[i].second &lt;&lt; std::endl; return 0; </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3038 Trac 1.4.3 Eric Niebler Fri, 15 May 2009 21:28:40 GMT status, component changed https://svn.boost.org/trac10/ticket/3038#comment:1 https://svn.boost.org/trac10/ticket/3038#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">accumulator</span> </li> </ul> Ticket Eric Niebler Fri, 29 May 2009 18:29:18 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3038#comment:2 https://svn.boost.org/trac10/ticket/3038#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> According to Matthias Troyer: </p> <blockquote> <p> It actually makes sense, since the density estimator first needs to collect a certain number of samples before it can make an educated guess about the locations and widths of histogram bins. It does not make sense to inquire the density before that. </p> </blockquote> <p> Therefore, this is not a bug by by design. I have now documented the precondition on density result extraction, both in the code and in the users' guide (see changelist <a class="changeset" href="https://svn.boost.org/trac10/changeset/53405" title="document precondition on result extraction for density accumulator">[53405]</a>). </p> Ticket