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

Distribution is the sum of a set of kernel functions placed on the training samples.
Essentially a special case of a mixture model. It differs from the former in that a) every component has the same shape, though possibly a different width b) every component has the same weight c) Usually one uses different training algorithms. Mixture models are more general.
Definition at line 24 of file pdf1d_kernel_pdf.h.
Public Member Functions | |
| pdf1d_kernel_pdf () | |
| Dflt ctor. | |
| virtual | ~pdf1d_kernel_pdf () |
| Destructor. | |
| virtual void | set_centres (const vnl_vector< double > &x, double width) |
| Initialise so all kernels have the same width. | |
| virtual void | set_centres (const vnl_vector< double > &x, const vnl_vector< double > &width) |
| Initialise so all kernels have given width. | |
| const vnl_vector< double > & | centre () const |
| Position of kernel centres. | |
| const vnl_vector< double > & | width () const |
| Width of each kernel. | |
| bool | all_same_width () const |
| True if all kernels have the same width. | |
| virtual double | inverse_cdf (double P) const |
| The inverse cdf. | |
| 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 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 | log_p (double x) const =0 |
| Log of probability density at x. | |
| virtual double | operator() (double x) const |
| 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 =0 |
| Gradient and value of PDF at x. | |
| virtual pdf1d_sampler * | new_sampler () const =0 |
| Create a sampler object on the heap. | |
| virtual double | log_prob_thresh (double pass_proportion) const |
| Compute threshold for PDF to pass a given proportion. | |
| virtual double | nearest_plausible (double x, double log_p_min) const =0 |
| Compute nearest point to x which has a density above a threshold. | |
| virtual bool | is_valid_pdf () const |
| Return true if the object represents a valid PDF. | |
| void | get_samples (vnl_vector< double > &x) const |
| Fill x with samples drawn from distribution. | |
| virtual pdf1d_pdf * | clone () const =0 |
| Create a copy on the heap and return base class pointer. | |
| 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) |
Protected Attributes | |
| vnl_vector< double > | x_ |
| Position of kernel centres. | |
| vnl_vector< double > | width_ |
| Width of each kernel. | |
| vcl_vector< int > | index_ |
| Workspace. | |
| bool | all_same_width_ |
| True if all kernels have the same width. | |
|
|
Dflt ctor.
Definition at line 22 of file pdf1d_kernel_pdf.cxx. |
|
|
Destructor.
Definition at line 28 of file pdf1d_kernel_pdf.cxx. |
|
|
True if all kernels have the same width.
Definition at line 61 of file pdf1d_kernel_pdf.h. |
|
|
Load class from binary file stream.
Implements pdf1d_pdf. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_gaussian_kernel_pdf, and pdf1d_weighted_kernel_pdf. Definition at line 205 of file pdf1d_kernel_pdf.cxx. |
|
|
Save class to binary file stream.
Implements pdf1d_pdf. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_gaussian_kernel_pdf, and pdf1d_weighted_kernel_pdf. Definition at line 194 of file pdf1d_kernel_pdf.cxx. |
|
|
Cumulative Probability (P(x'<x) for x' drawn from the distribution. By default this can be calculated by drawing random samples from the distribution and computing the number less than x. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. Definition at line 44 of file pdf1d_pdf.cxx. |
|
|
Return true if cdf() uses an analytic implementation. Default is false, as the base implementation is to draw samples from the distribution randomly to estimate cdf(x) Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. Definition at line 61 of file pdf1d_pdf.cxx. |
|
|
Position of kernel centres.
Definition at line 55 of file pdf1d_kernel_pdf.h. |
|
|
Create a copy on the heap and return base class pointer.
Implemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. |
|
|
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 131 of file pdf1d_pdf.cxx. |
|
||||||||||||
|
Gradient and value of PDF at x. Computes gradient of PDF at x, and returns the prob at x in p Implemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. |
|
|
The inverse cdf. The value of x: P(x'<x) = P for x' drawn from distribution pdf. Uses Newton-Raphson. Reimplemented from pdf1d_pdf. Definition at line 68 of file pdf1d_kernel_pdf.cxx. |
|
|
Name of the class.
Reimplemented from pdf1d_pdf. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_gaussian_kernel_pdf, pdf1d_weighted_epanech_kernel_pdf, and pdf1d_weighted_kernel_pdf. Definition at line 164 of file pdf1d_kernel_pdf.cxx. |
|
|
Does the name of the class match the argument?.
Reimplemented from pdf1d_pdf. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_gaussian_kernel_pdf, pdf1d_weighted_epanech_kernel_pdf, and pdf1d_weighted_kernel_pdf. Definition at line 172 of file pdf1d_kernel_pdf.cxx. |
|
|
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 in pdf1d_mixture. Definition at line 125 of file pdf1d_pdf.cxx. |
|
|
Log of probability density at x.
Implemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. |
|
|
Compute threshold for PDF to pass a given proportion.
Reimplemented in pdf1d_exponential, pdf1d_flat, and pdf1d_gaussian. Definition at line 67 of file pdf1d_pdf.cxx. |
|
|
Mean of distribution.
Definition at line 42 of file pdf1d_pdf.h. |
|
|
Number of peaks of distribution.
Definition at line 48 of file pdf1d_pdf.h. |
|
||||||||||||
|
Compute nearest point to x which has a density above a threshold. If log_p(x)>log_p_min then x returned unchanged. Otherwise move (typically up the gradient) until log_p(x)>=log_p_min. Implemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. |
|
|
Create a sampler object on the heap. Caller is responsible for deletion. Implemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. |
|
|
Probability density at x.
Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_exponential, pdf1d_flat, pdf1d_gaussian_kernel_pdf, pdf1d_mixture, and pdf1d_weighted_epanech_kernel_pdf. Definition at line 36 of file pdf1d_pdf.cxx. |
|
|
Position of the i'th peak.
Definition at line 51 of file pdf1d_pdf.h. |
|
|
Print class to os.
Implements pdf1d_pdf. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_gaussian_kernel_pdf, and pdf1d_weighted_kernel_pdf. Definition at line 186 of file pdf1d_kernel_pdf.cxx. |
|
||||||||||||
|
Initialise so all kernels have given width.
Reimplemented in pdf1d_weighted_kernel_pdf. Definition at line 49 of file pdf1d_kernel_pdf.cxx. |
|
||||||||||||
|
Initialise so all kernels have the same width.
Reimplemented in pdf1d_weighted_kernel_pdf. Definition at line 34 of file pdf1d_kernel_pdf.cxx. |
|
|
Reimplemented in pdf1d_gaussian. Definition at line 31 of file pdf1d_pdf.h. |
|
|
Definition at line 32 of file pdf1d_pdf.h. |
|
|
Variance of each dimension.
Definition at line 45 of file pdf1d_pdf.h. |
|
|
Version number for I/O.
Reimplemented from pdf1d_pdf. Reimplemented in pdf1d_epanech_kernel_pdf, pdf1d_gaussian_kernel_pdf, pdf1d_weighted_epanech_kernel_pdf, and pdf1d_weighted_kernel_pdf. Definition at line 179 of file pdf1d_kernel_pdf.cxx. |
|
|
Width of each kernel.
Definition at line 58 of file pdf1d_kernel_pdf.h. |
|
||||||||||||||||||||
|
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 141 of file pdf1d_pdf.cxx. |
|
|
True if all kernels have the same width.
Definition at line 38 of file pdf1d_kernel_pdf.h. |
|
|
Workspace. If non-empty x_(index[i]) <= x_(index[i+1]) Definition at line 35 of file pdf1d_kernel_pdf.h. |
|
|
Width of each kernel.
Definition at line 31 of file pdf1d_kernel_pdf.h. |
|
|
Position of kernel centres.
Definition at line 28 of file pdf1d_kernel_pdf.h. |
1.4.4