Histogram class with running statistics, can be constructed from the parameters of the bins or from a dataset.
More...
|
| | histogram ()=default |
| | Default constructor, creates an empty histogram with no bins and NaN range.
|
| | histogram (unsigned int bin_count, real range_min, real range_max) |
| | Construct the histogram from the number of bins and the range.
|
| template<typename Dataset, enable_vector< Dataset > = true> |
| | histogram (const Dataset &data, unsigned int bin_count=0) |
| | Construct the histogram from a set of data points, with the given number of bins.
|
| void | insert (real x) |
| | Insert a new data point inside the histogram, updating the running statistics and the corresponding bin.
|
| unsigned int | index (real x) const |
| | Find the bin index corresponding to a given data point.
|
| vec2 | range () const |
| | Get the histogram range as a vector of two elements, containing the lower and upper extremes.
|
| unsigned int | number () const |
| | Get the number of data points inside the histogram.
|
| std::vector< unsigned int > | bins () const |
| | Get a vector containing the bin counts of each bin.
|
|
real | range_lower () const |
| | Return the lower extreme of the histogram range.
|
|
real | range_upper () const |
| | Return the upper extreme of the histogram range.
|
| real | max () const |
| | Get the biggest data point of the histogram.
|
| real | min () const |
| | Get the smallest data point of the histogram.
|
| real | mean () const |
| | Get the mean value of the histogram data.
|
| real | tss () const |
| | Get the total sum of squares (TSS) computed using Welford's one-pass method.
|
|
void | rebuild (const std::vector< unsigned int > &bin_counts, const vec2 &range, size_t N, real run_average, real run_tss, real value_min, real value_max) |
| | Rebuild the histogram from its parameters, including the bin counts and the running statistics (used for file IO).
|
| real | operator() (real x) |
| | Evaluate the histogram like a step function which is zero outside the range of the histogram.
|
| unsigned int | operator[] (unsigned int i) const |
| | Get the number of elements in the i-th bin.
|
| std::string | to_string (const std::string &separator=" ", bool normalized=true, bool lower_extreme=false) const |
| | Convert the histogram to string representation.
|
|
| operator std::string () |
| | Convert the histogram to string representation.
|
Histogram class with running statistics, can be constructed from the parameters of the bins or from a dataset.
Elements are inserted one by one, updating the running statistics for the TSS, mean, maximum and minimum on each step.
template<typename Dataset, enable_vector< Dataset > = true>
| theoretica::histogram::histogram |
( |
const Dataset & | data, |
|
|
unsigned int | bin_count = 0 ) |
|
inline |
Construct the histogram from a set of data points, with the given number of bins.
If the number of bins is not specified, it defaults to \([\sqrt{N}]\).
- Parameters
-
| data | The set of data points |
| bin_count | The number of bins (defaults to the square root of the number of points) |