This class creates a histogram of a list of points and stores the number of bins in num_bins, the maximum and minimum values allowed in histo_max and histo_min, respectively, and the count of the number of points in each bin in histo_bins, which is a Vector of size num_bins.
More...
#include <learned_discrete_prior.h>
|
static void | find_min_max (double &hmax, double &hmin, const char *fname) |
|
static const char * | read_field_value (std::istream &in, const char *field_name, char *field_buf, size_t buf_len, char separator=':') |
| Reads a line off in into a buffer and returns a pointer to the field value in the buffer. More...
|
|
static const char * | read_field_value (std::istream &in, const char *field_name, char separator=':') |
| Reads a line off in into an internal buffer and returns a pointer to the field value in the buffer. More...
|
|
|
void | find_bin (double &bin, double element, int numBins, double min, double max) const |
| Determines which bin in the histogram the given element should be put in. More...
|
|
This class creates a histogram of a list of points and stores the number of bins in num_bins, the maximum and minimum values allowed in histo_max and histo_min, respectively, and the count of the number of points in each bin in histo_bins, which is a Vector of size num_bins.
Learned_discrete_prior::Learned_discrete_prior |
( |
int |
numBins, |
|
|
double |
max, |
|
|
double |
min, |
|
|
const char * |
fname, |
|
|
int |
softBin = 1 |
|
) |
| |
Constructor.
- Parameters
-
numBins | Number of bins in the histogram. |
max | Double representing the maximum value of the histogram. |
min | Double representing the minimum value of the histogram. |
fname | Input file to read the data to build the histogram from. |
softBin | 1 if want to create histogram using soft-binning (default), 0 if not. |
kjb::Learned_discrete_prior::Learned_discrete_prior |
( |
| ) |
|
|
inline |
Copy constructor.
- Parameters
-
Constructs a parametric_parapiped from an input file.
Constructs a parametric_parapiped from an input stream.
Learned_discrete_prior::~Learned_discrete_prior |
( |
| ) |
|
Destructor.
Frees all space allocated by this object.
double kjb::Learned_discrete_prior::evaluate_prior |
( |
double |
value | ) |
const |
|
inline |
void Learned_discrete_prior::find_bin |
( |
double & |
bin, |
|
|
double |
element, |
|
|
int |
numBins, |
|
|
double |
min, |
|
|
double |
max |
|
) |
| const |
|
protected |
Determines which bin in the histogram the given element should be put in.
- Parameters
-
bin | Double to store the number of the bin to add the element to. |
element | The element to be added to the histogram. |
numBins | The number of bins in the histogram. |
min | The minimum value that can be added to the histogram. |
max | The maximum value that can be added to the histogram. |
void Learned_discrete_prior::find_min_max |
( |
double & |
hmax, |
|
|
double & |
hmin, |
|
|
const char * |
fname |
|
) |
| |
|
static |
const Vector & Learned_discrete_prior::get_histo_bins |
( |
| ) |
const |
Returns the Vector containing the count of points in each bin.
- Returns
- The Vector containing the count of points in each bin.
double Learned_discrete_prior::get_histo_max |
( |
| ) |
const |
Returns the maximum value of the histogram.
- Returns
- The maximum value of the histogram.
double Learned_discrete_prior::get_histo_min |
( |
| ) |
const |
Returns the minimum value of the histogram.
- Returns
- The minimum value of the histogram.
int Learned_discrete_prior::get_num_bins |
( |
| ) |
const |
Returns the number of bins.
- Returns
- The number of bins in the histogram.
Assignment operator.
Performs a deep copy of the histogram bins.
- Parameters
-
- Returns
- A reference to this Learned_discrete_prior.
int Learned_discrete_prior::plot_histogram |
( |
const char * |
name = NULL | ) |
const |
Creates a plot of the histogram and saves it in ps format in a file with the provided name or plot.ps if no name is provided.
- Parameters
-
name | The name of the ps file the histogram plot will be saved to. If NULL, the plot will be saved to a file called plot.ps |
- Returns
- NO_ERROR on success and ERROR on failure.
Reads this parametric_parapiped from an input stream.
Implements kjb::Readable.
Reads this parametric_parapiped from a file.
Reimplemented from kjb::Readable.
void Learned_discrete_prior::write |
( |
std::ostream & |
out | ) |
const |
throw | ( | kjb::IO_error |
| ) | | |
|
virtual |
Writes this parametric_parapiped to a file.
Writes this learn_discrete_prior to a file.
Implements kjb::Writeable.
virtual void kjb::Learned_discrete_prior::write |
( |
const char * |
fname | ) |
const |
throw | ( | kjb::IO_error |
| ) | | |
|
inlinevirtual |
Writes this parametric_parapiped to an output stream.
Reimplemented from kjb::Writeable.
The documentation for this class was generated from the following files: