Instance class for vpdfl_mixture. More...
#include <vpdfl_mixture_sampler.h>
Public Member Functions | |
vpdfl_mixture_sampler () | |
Dflt ctor. | |
vpdfl_mixture_sampler (const vpdfl_mixture_sampler &) | |
Copy ctor. | |
vpdfl_mixture_sampler & | operator= (const vpdfl_mixture_sampler &) |
Copy operator. | |
virtual | ~vpdfl_mixture_sampler () |
Destructor. | |
virtual void | set_model (const vpdfl_pdf_base &) |
Set model for which this is an instance. | |
const vpdfl_mixture & | mixture () const |
virtual void | sample (vnl_vector< double > &x) |
Draw random sample from distribution. | |
virtual void | reseed (unsigned long) |
Reseeds the static random number generator (one per derived class). | |
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 vpdfl_sampler_base * | clone () const |
Create a copy on the heap and return base class pointer. | |
const vpdfl_pdf_base & | model () const |
PDF of which this is an instance. | |
virtual void | get_samples (vcl_vector< vnl_vector< double > > &x) |
Fill x with samples drawn from distribution. | |
virtual void | regular_samples (vcl_vector< vnl_vector< double > > &x) |
Fill x with samples possibly chosen so as to represent the distribution. | |
virtual void | regular_samples_and_prob (vcl_vector< vnl_vector< double > > &x, vnl_vector< double > &p) |
Fill x with samples possibly chosen so as to represent the distribution. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
Protected Attributes | |
vnl_random | rng_ |
The random number generator. | |
const vpdfl_pdf_base * | pdf_model_ |
Private Member Functions | |
void | init () |
void | delete_stuff () |
Private Attributes | |
vcl_vector< vpdfl_sampler_base * > | inst_ |
workspace. |
Instance class for vpdfl_mixture.
Implements calculation of prob, gradient, sampling etc
Definition at line 20 of file vpdfl_mixture_sampler.h.
vpdfl_mixture_sampler::vpdfl_mixture_sampler | ( | ) |
Dflt ctor.
Definition at line 29 of file vpdfl_mixture_sampler.cxx.
vpdfl_mixture_sampler::vpdfl_mixture_sampler | ( | const vpdfl_mixture_sampler & | m | ) |
Copy ctor.
Definition at line 35 of file vpdfl_mixture_sampler.cxx.
vpdfl_mixture_sampler::~vpdfl_mixture_sampler | ( | ) | [virtual] |
Destructor.
Definition at line 66 of file vpdfl_mixture_sampler.cxx.
vpdfl_sampler_base * vpdfl_mixture_sampler::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements vpdfl_sampler_base.
Definition at line 150 of file vpdfl_mixture_sampler.cxx.
void vpdfl_mixture_sampler::delete_stuff | ( | ) | [private] |
Definition at line 58 of file vpdfl_mixture_sampler.cxx.
void vpdfl_sampler_base::get_samples | ( | vcl_vector< vnl_vector< double > > & | x | ) | [virtual, inherited] |
Fill x with samples drawn from distribution.
Definition at line 48 of file vpdfl_sampler_base.cxx.
void vpdfl_mixture_sampler::init | ( | ) | [private] |
Definition at line 25 of file vpdfl_mixture_sampler.cxx.
vcl_string vpdfl_mixture_sampler::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from vpdfl_sampler_base.
Definition at line 129 of file vpdfl_mixture_sampler.cxx.
bool vpdfl_mixture_sampler::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Does the name of the class match the argument?.
Reimplemented from vpdfl_sampler_base.
Definition at line 136 of file vpdfl_mixture_sampler.cxx.
const vpdfl_mixture & vpdfl_mixture_sampler::mixture | ( | ) | const |
Definition at line 73 of file vpdfl_mixture_sampler.cxx.
const vpdfl_pdf_base & vpdfl_sampler_base::model | ( | ) | const [inherited] |
PDF of which this is an instance.
Definition at line 40 of file vpdfl_sampler_base.cxx.
vpdfl_mixture_sampler & vpdfl_mixture_sampler::operator= | ( | const vpdfl_mixture_sampler & | m | ) |
Copy operator.
Definition at line 42 of file vpdfl_mixture_sampler.cxx.
void vpdfl_sampler_base::print_summary | ( | vcl_ostream & | os | ) | const [virtual, inherited] |
Print class to os.
Definition at line 104 of file vpdfl_sampler_base.cxx.
void vpdfl_sampler_base::regular_samples | ( | vcl_vector< vnl_vector< double > > & | x | ) | [virtual, inherited] |
Fill x with samples possibly chosen so as to represent the distribution.
Generate a set of pseudo-random samples, chosen so as to be suitable to represent the distribution. This is meant to be used for estimating continuous integrals with sampled approximations. Where there are multiple peaks (e.g. kernel or mixture models), it is preferred that the number of samples from each component is roughly proportional to the weight for the component. When small numbers are requested, this can be done explicitly. The default is simply to call sample() for each element of x
Reimplemented in vpdfl_gaussian_kernel_pdf_sampler.
Definition at line 57 of file vpdfl_sampler_base.cxx.
void vpdfl_sampler_base::regular_samples_and_prob | ( | vcl_vector< vnl_vector< double > > & | x, |
vnl_vector< double > & | p | ||
) | [virtual, inherited] |
Fill x with samples possibly chosen so as to represent the distribution.
As regular_samples(x), but p[i] is set to p(x[i])
Definition at line 67 of file vpdfl_sampler_base.cxx.
void vpdfl_mixture_sampler::reseed | ( | unsigned long | seed | ) | [virtual] |
Reseeds the static random number generator (one per derived class).
Implements vpdfl_sampler_base.
Definition at line 119 of file vpdfl_mixture_sampler.cxx.
void vpdfl_mixture_sampler::sample | ( | vnl_vector< double > & | x | ) | [virtual] |
Draw random sample from distribution.
For generating plausible examples.
Implements vpdfl_sampler_base.
Definition at line 98 of file vpdfl_mixture_sampler.cxx.
void vpdfl_mixture_sampler::set_model | ( | const vpdfl_pdf_base & | m | ) | [virtual] |
Set model for which this is an instance.
Reimplemented from vpdfl_sampler_base.
Definition at line 81 of file vpdfl_mixture_sampler.cxx.
short vpdfl_mixture_sampler::version_no | ( | ) | const |
Version number for I/O.
Definition at line 143 of file vpdfl_mixture_sampler.cxx.
vcl_vector<vpdfl_sampler_base*> vpdfl_mixture_sampler::inst_ [private] |
workspace.
Definition at line 24 of file vpdfl_mixture_sampler.h.
const vpdfl_pdf_base* vpdfl_sampler_base::pdf_model_ [protected, inherited] |
Definition at line 31 of file vpdfl_sampler_base.h.
vnl_random vpdfl_mixture_sampler::rng_ [protected] |
The random number generator.
Definition at line 31 of file vpdfl_mixture_sampler.h.