GClasses
|
Gathers values and puts them in bins.
#include <GHistogram.h>
Public Member Functions | |
GHistogram (double min, double max, size_t binCount) | |
This creates an empty histogram. You will need to call addSample To fill it with values. More... | |
GHistogram (GMatrix &data, size_t col, double xmin=UNKNOWN_REAL_VALUE, double xmax=UNKNOWN_REAL_VALUE, size_t maxBuckets=10000000) | |
Creates a histogram and fills it with values in the specified column of data. If xmin and/or xmax are UNKNOWN_REAL_VALUE, then it will determine a suitable range automatically. The number of buckets will be computed as min(maxBuckets,floor(sqrt(data.rows))). More... | |
~GHistogram () | |
void | addSample (double x, double weight=1.0) |
Adds a sample to the histogram. More... | |
size_t | binCount () |
Returns the number of bins in the histogram. More... | |
double | binLikelihood (size_t n) |
Returns the relative likelihood of the specified bin. (This is typically plotted as the height, or y-value for the specified bin.) More... | |
double | binProbability (size_t n) |
Returns the probability that a value falls in the specified bin. More... | |
double | binToX (size_t n) |
Returns the center (median) x-value represented by the specified binsum value in the specified bin. More... | |
double | computeRange () |
Returns the difference between the max and min likelihood values in the histogram. More... | |
size_t | modeBin () |
Returns the index of the bin with the largest sum. More... | |
void | toFile (const char *filename) |
Dumps to a file. You can then plot itwith GnuPlot or something similar. More... | |
double | xmax () |
Returns the maximum x value. That is, the value that will fall just beyond that greatest bucket. More... | |
double | xmin () |
Returns the minimum x value that will fall into one of the buckets. More... | |
size_t | xToBin (double x) |
Returns the bin into which the specified value would fall. returns INVALID_INDEX if the value falls outside all of the bins. More... | |
Protected Attributes | |
size_t | m_binCount |
double * | m_bins |
double | m_max |
double | m_min |
double | m_sum |
GClasses::GHistogram::GHistogram | ( | double | min, |
double | max, | ||
size_t | binCount | ||
) |
This creates an empty histogram. You will need to call addSample To fill it with values.
GClasses::GHistogram::GHistogram | ( | GMatrix & | data, |
size_t | col, | ||
double | xmin = UNKNOWN_REAL_VALUE , |
||
double | xmax = UNKNOWN_REAL_VALUE , |
||
size_t | maxBuckets = 10000000 |
||
) |
Creates a histogram and fills it with values in the specified column of data. If xmin and/or xmax are UNKNOWN_REAL_VALUE, then it will determine a suitable range automatically. The number of buckets will be computed as min(maxBuckets,floor(sqrt(data.rows))).
GClasses::GHistogram::~GHistogram | ( | ) |
void GClasses::GHistogram::addSample | ( | double | x, |
double | weight = 1.0 |
||
) |
Adds a sample to the histogram.
size_t GClasses::GHistogram::binCount | ( | ) |
Returns the number of bins in the histogram.
double GClasses::GHistogram::binLikelihood | ( | size_t | n | ) |
Returns the relative likelihood of the specified bin. (This is typically plotted as the height, or y-value for the specified bin.)
double GClasses::GHistogram::binProbability | ( | size_t | n | ) |
Returns the probability that a value falls in the specified bin.
double GClasses::GHistogram::binToX | ( | size_t | n | ) |
Returns the center (median) x-value represented by the specified binsum value in the specified bin.
double GClasses::GHistogram::computeRange | ( | ) |
Returns the difference between the max and min likelihood values in the histogram.
size_t GClasses::GHistogram::modeBin | ( | ) |
Returns the index of the bin with the largest sum.
void GClasses::GHistogram::toFile | ( | const char * | filename | ) |
Dumps to a file. You can then plot itwith GnuPlot or something similar.
|
inline |
Returns the maximum x value. That is, the value that will fall just beyond that greatest bucket.
|
inline |
Returns the minimum x value that will fall into one of the buckets.
size_t GClasses::GHistogram::xToBin | ( | double | x | ) |
Returns the bin into which the specified value would fall. returns INVALID_INDEX if the value falls outside all of the bins.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |