1 #ifndef STATISTICS_HISTOGRAM_H 2 #define STATISTICS_HISTOGRAM_H 20 void Resize(
size_t n,Real a,Real b);
22 void ResizeToFit(
const std::vector<Real>& data,
size_t n);
24 void Fill(Real val=0);
26 void Calculate(
const std::vector<Real>& data);
28 void GetRange(
int bucket,Real& min,Real& max)
const;
29 int GetBucket(Real val)
const;
30 void AddBucket(Real val,Real num=1);
31 Real GetBucketCount(
int bucket)
const {
return buckets[bucket]; }
32 Real NumObservations()
const;
34 std::vector<Real> divs;
1-D histogram class
Definition: Histogram.h:11
void Calculate(const std::vector< Real > &data)
Calculates the histogram of the data.
Definition: Histogram.cpp:62
std::vector< Real > buckets
divs.size()+1 buckets (-inf,x0),[x1,x2),...,[xn-1,xn),[xn,inf)
Definition: Histogram.h:36
void Clear()
Creates one big bucket.
Definition: Histogram.cpp:16
Contains all definitions in the statistics directory.
Definition: BernoulliDistribution.h:6
void ResizeToFit(const std::vector< Real > &data, size_t n)
Creates n uniformly spaced buckets between the min and max of the data.
Definition: Histogram.cpp:46
Basic statistical utilities.
void Resize(Real split)
Creates buckets (-inf,split],(split,inf)
Definition: Histogram.cpp:22
void Fill(Real val=0)
Fills all buckets with the given value.
Definition: Histogram.cpp:57