JayBeams
0.1
Another project to have fun coding.
|
A histogram binning_strategy for integer numbers with user defined cuts. More...
#include <explicit_cuts_binning.hpp>
Public Types | |
typedef sample_type_t | sample_type |
type traits as required by binning_strategy_concept More... | |
Public Member Functions | |
explicit_cuts_binning (std::initializer_list< sample_type > const &il) | |
Constructor based on an initializer list. More... | |
template<typename iterator_t > | |
explicit_cuts_binning (iterator_t begin, iterator_t end) | |
Constructor based on an iterator range. More... | |
Implement binning_strategy_concept interface. | |
Please see binning_strategy_concept for detailed documentation of each member function. | |
sample_type | histogram_min () const |
sample_type | histogram_max () const |
sample_type | theoretical_min () const |
sample_type | theoretical_max () const |
std::size_t | sample2bin (sample_type t) const |
sample_type | bin2sample (std::size_t i) const |
sample_type | interpolate (sample_type x_a, sample_type x_b, double y_a, double s, double q) const |
Private Attributes | |
std::vector< sample_type > | cuts_ |
A histogram binning_strategy for integer numbers with user defined cuts.
This class defines histogram bins at cutting points explicity defined by the user. For example, cutting at [0, 1, 10, 100] would create 4 buckets, from 0 to 1, from 1 to 10, from 10 to 100. Samples below the minimum or maximum bucket are recorded as underflows or overflows, respectively.
Users can then create all kinds of interesting binning just by providing the right initial values, for example: [0, 1, 2, ..., 9, 10, 20, ..., 90, 100, ... , 900, 1000] offers a good tradeoff between accuracy and memory usage for tail heavy distributions.
Insertion takes O(log(n)) on the number of cuts.
sample_type_t | the type of samples, should be an integer type. |
Definition at line 33 of file explicit_cuts_binning.hpp.
typedef sample_type_t jb::explicit_cuts_binning< sample_type_t >::sample_type |
type traits as required by binning_strategy_concept
Definition at line 36 of file explicit_cuts_binning.hpp.
|
inlineexplicit |
Constructor based on an initializer list.
Definition at line 41 of file explicit_cuts_binning.hpp.
|
inline |
Constructor based on an iterator range.
Definition at line 49 of file explicit_cuts_binning.hpp.
References jb::explicit_cuts_binning< sample_type_t >::cuts_.
|
inline |
Definition at line 88 of file explicit_cuts_binning.hpp.
References jb::explicit_cuts_binning< sample_type_t >::cuts_.
|
inline |
Definition at line 75 of file explicit_cuts_binning.hpp.
References jb::explicit_cuts_binning< sample_type_t >::cuts_.
|
inline |
Definition at line 72 of file explicit_cuts_binning.hpp.
References jb::explicit_cuts_binning< sample_type_t >::cuts_.
|
inline |
Definition at line 91 of file explicit_cuts_binning.hpp.
References jb::histogram_binning_linear_interpolation().
|
inline |
Definition at line 84 of file explicit_cuts_binning.hpp.
References jb::explicit_cuts_binning< sample_type_t >::cuts_.
|
inline |
Definition at line 81 of file explicit_cuts_binning.hpp.
|
inline |
Definition at line 78 of file explicit_cuts_binning.hpp.
|
private |
Definition at line 98 of file explicit_cuts_binning.hpp.
Referenced by jb::explicit_cuts_binning< sample_type_t >::bin2sample(), jb::explicit_cuts_binning< sample_type_t >::explicit_cuts_binning(), jb::explicit_cuts_binning< sample_type_t >::histogram_max(), jb::explicit_cuts_binning< sample_type_t >::histogram_min(), and jb::explicit_cuts_binning< sample_type_t >::sample2bin().