|
template<typename IterType , typename BinType , typename = typename std::enable_if<std::is_move_constructible<BinType>::value>::type> |
| Histogram (IterType begin, IterType end, BinType &&bin_type) |
|
template<typename IterType , typename WeightIterType , typename BinType , typename = typename std::enable_if<std::is_move_constructible<BinType>::value>::type> |
| Histogram (IterType begin, IterType end, WeightIterType wbegin, ELEMENTS_UNUSED WeightIterType wend, BinType &&bin_type) |
|
| Histogram (const Histogram &other) |
|
| Histogram (Histogram &&)=default |
|
Histogram & | operator= (const Histogram &)=default |
|
Histogram & | operator= (Histogram &&)=default |
|
size_t | size () const |
|
std::vector< WeightType > | getCounts () const |
|
std::vector< VarType > | getEdges () const |
|
std::vector< VarType > | getBins () const |
|
std::pair< VarType, VarType > | getBinEdges (size_t i) const |
|
void | clip (VarType min, VarType max) |
|
std::tuple< VarType, VarType, VarType > | getStats () const |
|
template<typename VarType, typename WeightType = float>
class Euclid::Histogram::Histogram< VarType, WeightType >
Histogram
- Template Parameters
-
VarType | The type of the continuous variable. Must be an arithmetic type (either integral or floating point) |
WeightType | The type used for the counts, which is the same as the one accepted for the weights. |
Definition at line 138 of file Histogram.h.
template<typename VarType , typename WeightType = float>
template<typename IterType , typename BinType , typename = typename std::enable_if<std::is_move_constructible<BinType>::value>::type>
template<typename VarType , typename WeightType = float>
template<typename IterType , typename WeightIterType , typename BinType , typename = typename std::enable_if<std::is_move_constructible<BinType>::value>::type>
Constructor
- Template Parameters
-
IterType | Iterator type for both the edges and the values of the variable |
WeightIterType | Iterator type for the weights |
BinType | A concrete movable implementation of BinStrategy |
- Parameters
-
begin | Beginning of the data |
end | End of the data |
wbegin | Beginning of the weights |
wend | End of the weights |
bin_type | An instance of BinType. It will be taken ownership of by the Histogram |
- Note
- The number of values and weights must match
Definition at line 187 of file Histogram.h.
References Euclid::Histogram::Histogram< VarType, WeightType >::m_binning_concept, and std::move().
template<typename VarType , typename WeightType = float>
Compute the mean, the median and the standard deviation of the histogram
\[
\mu = \frac{\sum_{i=0}^{n} \mathit{bin}_i * \mathit{cnt}_i}{\sum_{i=0}^{n}cnt_i}
\]
\[
\sigma = \sqrt{\frac{\sum_{i=0}^n \mathit{cnt}_i \times (\mathit{center}_i - \mu)^2}{\sum_{i=0}^n \mathit{cnt}_i}}
\]
To find the median, a second pass is done over the bins, computing the cumulative distribution until the bin where it is greater or equal to 0.5. The median is then interpolated between the lower and higher edges.
- Returns
- A tuple (mean, median, sigma)
Definition at line 291 of file Histogram.h.
References Euclid::Histogram::Histogram< VarType, WeightType >::m_binning_concept.