Histogram class with running statistics, can be constructed from the parameters of the bins or from a dataset.
More...
|
| histogram (unsigned int bin_count, real range_min, real range_max) |
| Construct the histogram from the number of bins and the range. More...
|
|
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. More...
|
|
void | insert (real x) |
| Insert a new data point inside the histogram, updating the running statistics and the corresponding bin. More...
|
|
unsigned int | index (real x) const |
| Find the bin index corresponding to a given data point. More...
|
|
unsigned int | number () const |
| Get the number of data points inside the histogram. More...
|
|
std::vector< unsigned int > | bins () const |
| Get a vector containing the bin counts of each bin. More...
|
|
real | max () const |
| Get the biggest data point of the histogram. More...
|
|
real | min () const |
| Get the smallest data point of the histogram. More...
|
|
real | mean () const |
| Get the mean value of the histogram data. More...
|
|
real | tss () const |
| Get the total sum of squares (TSS) computed using Welford's one-pass method. More...
|
|
real | operator() (real x) |
| Evaluate the histogram like a step function which is zero outside the range of the histogram. More...
|
|
unsigned int | operator[] (unsigned int i) const |
| Get the number of elements in the i-th bin. More...
|
|
std::string | to_string (const std::string &separator=" ", bool normalized=true, bool lower_extreme=false) const |
| TO-DO Cumulative Distribution Function. More...
|
|
| 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) |