#include <pdf1d_mixture.h>
Inheritance diagram for pdf1d_mixture:

Definition at line 18 of file pdf1d_mixture.h.
Public Member Functions | |
| pdf1d_mixture () | |
| Dflt ctor. | |
| pdf1d_mixture (const pdf1d_mixture &) | |
| Copy ctor. | |
| pdf1d_mixture & | operator= (const pdf1d_mixture &) |
| Copy operator. | |
| virtual | ~pdf1d_mixture () |
| Destructor. | |
| virtual double | operator() (double x) const |
| Probability density at x. | |
| virtual double | log_p (double x) const |
| Log of probability density at x. | |
| virtual double | cdf (double x) const |
| Cumulative Probability (P(x'<x) for x' drawn from the distribution). | |
| virtual bool | cdf_is_analytic () const |
| Return true if cdf() uses an analytic implementation. | |
| virtual double | gradient (double x, double &p) const |
| Gradient of PDF at x. | |
| virtual double | nearest_plausible (double x, double log_p_min) const |
| Not Yet Implemented. | |
| void | init (const pdf1d_pdf &comp_type, int n) |
| Initialise to use n components of type comp_type. | |
| virtual pdf1d_sampler * | new_sampler () const |
| Return instance object for this PDF. | |
| unsigned | n_components () const |
| Number of components in mixture. | |
| double | weight (unsigned i) |
| Get ith weight. | |
| const vcl_vector< double > & | weights () const |
| Array of weights. | |
| vcl_vector< double > & | weights () |
| Array of weights. | |
| unsigned | nearest_comp (double x) const |
| Return index of component nearest to x. | |
| void | add_component (const pdf1d_pdf &comp) |
| Add a component to current model. | |
| void | clear () |
| Remove all components cleanly. | |
| const pdf1d_pdf & | component (unsigned i) const |
| Get ith component. | |
| vcl_vector< pdf1d_pdf * > & | components () |
| Access to components - for use by builders. | |
| const vcl_vector< pdf1d_pdf * > & | components () const |
| Access to components - for use by builders. | |
| void | set_mean_and_variance (double m, double v) |
| Set the whole pdf mean and variance values. | |
| virtual bool | is_valid_pdf () const |
| Return true if the object represents a valid PDF. | |
| short | version_no () const |
| Version number for I/O. | |
| virtual vcl_string | is_a () const |
| Name of the class. | |
| virtual bool | is_class (vcl_string const &s) const |
| Does the name of the class match the argument?. | |
| virtual pdf1d_pdf * | clone () const |
| Create a copy on the heap and return base class pointer. | |
| virtual void | print_summary (vcl_ostream &os) const |
| Print class to os. | |
| virtual void | b_write (vsl_b_ostream &bfs) const |
| Save class to binary file stream. | |
| virtual void | b_read (vsl_b_istream &bfs) |
| Load class from binary file stream. | |
| double | mean () const |
| Mean of distribution. | |
| double | variance () const |
| Variance of each dimension. | |
| virtual int | n_peaks () const |
| Number of peaks of distribution. | |
| virtual double | peak (int) const |
| Position of the i'th peak. | |
| virtual double | inverse_cdf (double P) const |
| The inverse cdf. | |
| virtual double | log_prob_thresh (double pass_proportion) const |
| Compute threshold for PDF to pass a given proportion. | |
| void | get_samples (vnl_vector< double > &x) const |
| Fill x with samples drawn from distribution. | |
| bool | write_plot_file (const vcl_string &plot_file, double min_x, double max_x, int n) const |
| Write values (x,p(x)) to text file suitable for plotting. | |
Protected Member Functions | |
| void | set_mean (double m) |
| void | set_variance (double v) |
Private Member Functions | |
| void | init () |
| void | delete_stuff () |
Private Attributes | |
| vcl_vector< pdf1d_pdf * > | component_ |
| vcl_vector< double > | weight_ |
| pdf1d_mixture::pdf1d_mixture | ( | ) |
| pdf1d_mixture::pdf1d_mixture | ( | const pdf1d_mixture & | ) |
| pdf1d_mixture::~pdf1d_mixture | ( | ) | [virtual] |
| void pdf1d_mixture::init | ( | ) | [private] |
Definition at line 22 of file pdf1d_mixture.cxx.
| void pdf1d_mixture::delete_stuff | ( | ) | [private] |
Definition at line 59 of file pdf1d_mixture.cxx.
| pdf1d_mixture & pdf1d_mixture::operator= | ( | const pdf1d_mixture & | ) |
| double pdf1d_mixture::operator() | ( | double | x | ) | const [virtual] |
Probability density at x.
Reimplemented from pdf1d_pdf.
Definition at line 249 of file pdf1d_mixture.cxx.
| double pdf1d_mixture::log_p | ( | double | x | ) | const [virtual] |
Log of probability density at x.
Implements pdf1d_pdf.
Definition at line 256 of file pdf1d_mixture.cxx.
| double pdf1d_mixture::cdf | ( | double | x | ) | const [virtual] |
Cumulative Probability (P(x'<x) for x' drawn from the distribution).
Reimplemented from pdf1d_pdf.
Definition at line 283 of file pdf1d_mixture.cxx.
| bool pdf1d_mixture::cdf_is_analytic | ( | ) | const [virtual] |
Return true if cdf() uses an analytic implementation.
Reimplemented from pdf1d_pdf.
Definition at line 295 of file pdf1d_mixture.cxx.
| double pdf1d_mixture::gradient | ( | double | x, | |
| double & | p | |||
| ) | const [virtual] |
| double pdf1d_mixture::nearest_plausible | ( | double | x, | |
| double | log_p_min | |||
| ) | const [virtual] |
Not Yet Implemented.
Compute nearest point to x which has a density above a threshold If log_p(x)>log_p_min then x unchanged. Otherwise x is moved (typically up the gradient) until log_p(x)>=log_p_min.
| x | This may be modified to the nearest plausible position. | |
| log_p_min | lower threshold for log_p(x) |
Implements pdf1d_pdf.
Definition at line 353 of file pdf1d_mixture.cxx.
| void pdf1d_mixture::init | ( | const pdf1d_pdf & | comp_type, | |
| int | n | |||
| ) |
Initialise to use n components of type comp_type.
Clones taken by comp_type
Definition at line 84 of file pdf1d_mixture.cxx.
| pdf1d_sampler * pdf1d_mixture::new_sampler | ( | ) | const [virtual] |
Return instance object for this PDF.
Object is created on heap. Caller responsible for deletion.
Implements pdf1d_pdf.
Definition at line 75 of file pdf1d_mixture.cxx.
| unsigned pdf1d_mixture::n_components | ( | ) | const [inline] |
| double pdf1d_mixture::weight | ( | unsigned | i | ) | [inline] |
| const vcl_vector<double>& pdf1d_mixture::weights | ( | ) | const [inline] |
| vcl_vector<double>& pdf1d_mixture::weights | ( | ) | [inline] |
Array of weights.
Warning care must be taken to ensure consistency when modifying weights Warning. Use weight(i) where possible
Definition at line 83 of file pdf1d_mixture.h.
| unsigned pdf1d_mixture::nearest_comp | ( | double | x | ) | const |
| void pdf1d_mixture::add_component | ( | const pdf1d_pdf & | comp | ) |
Add a component to current model.
Clone taken of comp
Definition at line 98 of file pdf1d_mixture.cxx.
| void pdf1d_mixture::clear | ( | ) |
| const pdf1d_pdf& pdf1d_mixture::component | ( | unsigned | i | ) | const [inline] |
| vcl_vector<pdf1d_pdf*>& pdf1d_mixture::components | ( | ) | [inline] |
Access to components - for use by builders.
Care must be taken to ensure consistency when modifying Use component(i) where possible
Definition at line 101 of file pdf1d_mixture.h.
| const vcl_vector<pdf1d_pdf*>& pdf1d_mixture::components | ( | ) | const [inline] |
Access to components - for use by builders.
Use component(i) where possible
Definition at line 105 of file pdf1d_mixture.h.
| void pdf1d_mixture::set_mean_and_variance | ( | double | m, | |
| double | v | |||
| ) |
Set the whole pdf mean and variance values.
Components and Weights should already be correct so that the error checking can work. define NDEBUG to turn off error checking.
Definition at line 148 of file pdf1d_mixture.cxx.
| bool pdf1d_mixture::is_valid_pdf | ( | ) | const [virtual] |
Return true if the object represents a valid PDF.
This will return false, if n_dims() is 0, for example just ofter default construction.
Reimplemented from pdf1d_pdf.
Definition at line 130 of file pdf1d_mixture.cxx.
| short pdf1d_mixture::version_no | ( | ) | const |
Version number for I/O.
Reimplemented from pdf1d_pdf.
Definition at line 171 of file pdf1d_mixture.cxx.
| vcl_string pdf1d_mixture::is_a | ( | ) | const [virtual] |
| bool pdf1d_mixture::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Does the name of the class match the argument?.
Reimplemented from pdf1d_pdf.
Definition at line 164 of file pdf1d_mixture.cxx.
| pdf1d_pdf * pdf1d_mixture::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements pdf1d_pdf.
Definition at line 178 of file pdf1d_mixture.cxx.
| void pdf1d_mixture::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
| void pdf1d_mixture::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements pdf1d_pdf.
Definition at line 201 of file pdf1d_mixture.cxx.
| void pdf1d_mixture::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements pdf1d_pdf.
Definition at line 212 of file pdf1d_mixture.cxx.
| void pdf1d_pdf::set_mean | ( | double | m | ) | [inline, protected, inherited] |
| void pdf1d_pdf::set_variance | ( | double | v | ) | [inline, protected, inherited] |
Definition at line 32 of file pdf1d_pdf.h.
| double pdf1d_pdf::mean | ( | ) | const [inline, inherited] |
| double pdf1d_pdf::variance | ( | ) | const [inline, inherited] |
| virtual int pdf1d_pdf::n_peaks | ( | ) | const [inline, virtual, inherited] |
| virtual double pdf1d_pdf::peak | ( | int | ) | const [inline, virtual, inherited] |
| double pdf1d_pdf::inverse_cdf | ( | double | P | ) | const [virtual, inherited] |
The inverse cdf.
The value of x: P(x'<x) = P for x' drawn from distribution pdf. The default version of this algorithm uses sampling if !cdf_is_analytic(), and Newton-Raphson root finding otherwise.
Reimplemented in pdf1d_kernel_pdf.
Definition at line 288 of file pdf1d_pdf.cxx.
| double pdf1d_pdf::log_prob_thresh | ( | double | pass_proportion | ) | const [virtual, inherited] |
Compute threshold for PDF to pass a given proportion.
Reimplemented in pdf1d_exponential, pdf1d_flat, and pdf1d_gaussian.
Definition at line 68 of file pdf1d_pdf.cxx.
| void pdf1d_pdf::get_samples | ( | vnl_vector< double > & | x | ) | const [inherited] |
Fill x with samples drawn from distribution.
Utility function. This calls new_sampler() to do the work, then deletes the sampler again. If you intend calling this repeatedly, create a sampler yourself.
Definition at line 132 of file pdf1d_pdf.cxx.
| bool pdf1d_pdf::write_plot_file | ( | const vcl_string & | plot_file, | |
| double | min_x, | |||
| double | max_x, | |||
| int | n | |||
| ) | const [inherited] |
Write values (x,p(x)) to text file suitable for plotting.
Evaluate pdf at n points in range [min_x,max_x] and write a text file, each line of which is {x p(x)}, suitable for plotting with many graph packages
Definition at line 142 of file pdf1d_pdf.cxx.
vcl_vector<pdf1d_pdf*> pdf1d_mixture::component_ [private] |
Definition at line 20 of file pdf1d_mixture.h.
vcl_vector<double> pdf1d_mixture::weight_ [private] |
Definition at line 21 of file pdf1d_mixture.h.
1.5.1