Public Types | Public Member Functions | Static Public Member Functions
vpdfl_gaussian_kernel_pdf_builder Class Reference

Class to build vpdfl_gaussian_kernel_pdf objects. More...

#include <vpdfl_gaussian_kernel_pdf_builder.h>

Inheritance diagram for vpdfl_gaussian_kernel_pdf_builder:
Inheritance graph
[legend]

List of all members.

Public Types

enum  build_type { fixed_width, select_equal, width_from_sep, adaptive }

Public Member Functions

 vpdfl_gaussian_kernel_pdf_builder ()
 Dflt ctor.
virtual ~vpdfl_gaussian_kernel_pdf_builder ()
 Destructor.
virtual vpdfl_pdf_basenew_model () const
 Create empty model.
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_builder_baseclone () const
 Create a copy on the heap and return base class pointer.
void set_use_fixed_width (double width)
 Use fixed width kernels of given width when building.
void set_use_equal_width ()
 Use equal width kernels of width depending on number of samples.
void set_use_width_from_separation ()
 Kernel width proportional to distance to nearby samples.
void set_use_adaptive ()
 Build adaptive kernel estimate.
virtual void set_min_var (double min_var)
 Define lower threshold on variance for built models.
virtual double min_var () const
 Get lower threshold on variance for built models.
virtual void build (vpdfl_pdf_base &model, const vnl_vector< double > &mean) const
 Build default model with given mean.
virtual void build (vpdfl_pdf_base &model, mbl_data_wrapper< vnl_vector< double > > &data) const
 Build model from data.
void build_from_array (vpdfl_pdf_base &model, const vnl_vector< double > *data, int n) const
 Build kernel_pdf from n elements in data[i].
virtual void weighted_build (vpdfl_pdf_base &model, mbl_data_wrapper< vnl_vector< double > > &data, const vcl_vector< double > &wts) const
 Build model from weighted data.
void build_fixed_width (vpdfl_kernel_pdf &kpdf, const vnl_vector< double > *data, int n, double width) const
 Build from n elements in data[i]. Fixed kernel width.
void build_select_equal_width (vpdfl_kernel_pdf &kpdf, const vnl_vector< double > *data, int n) const
 Build from n elements in data[i]. Chooses width.
void build_width_from_separation (vpdfl_kernel_pdf &kpdf, const vnl_vector< double > *data, int n) const
 Kernel width proportional to distance to nearby samples.
void build_adaptive (vpdfl_kernel_pdf &kpdf, const vnl_vector< double > *data, int n) const
 Build adaptive kernel estimate.
short version_no () const
 Version number for I/O.
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.
virtual void config_from_stream (vcl_istream &is)
 Read initialisation settings from a stream.

Static Public Member Functions

static vcl_auto_ptr
< vpdfl_builder_base
new_builder_from_stream (vcl_istream &is)
 Create a vpdfl_builder_base object given a config stream.
static vcl_auto_ptr
< vpdfl_builder_base
new_pdf_builder_from_stream (vcl_istream &)
 Create a vpdfl_builder_base object given a config stream (recursive style).

Detailed Description

Class to build vpdfl_gaussian_kernel_pdf objects.

Definition at line 19 of file vpdfl_gaussian_kernel_pdf_builder.h.


Member Enumeration Documentation

Enumerator:
fixed_width 
select_equal 
width_from_sep 
adaptive 

Definition at line 39 of file vpdfl_kernel_pdf_builder.h.


Constructor & Destructor Documentation

vpdfl_gaussian_kernel_pdf_builder::vpdfl_gaussian_kernel_pdf_builder ( )

Dflt ctor.

Definition at line 16 of file vpdfl_gaussian_kernel_pdf_builder.cxx.

vpdfl_gaussian_kernel_pdf_builder::~vpdfl_gaussian_kernel_pdf_builder ( ) [virtual]

Destructor.

Definition at line 24 of file vpdfl_gaussian_kernel_pdf_builder.cxx.


Member Function Documentation

void vpdfl_kernel_pdf_builder::b_read ( vsl_b_istream bfs) [virtual, inherited]

Load class from binary file stream.

Implements vpdfl_builder_base.

Definition at line 339 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::b_write ( vsl_b_ostream bfs) const [virtual, inherited]

Save class to binary file stream.

Implements vpdfl_builder_base.

Definition at line 329 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build ( vpdfl_pdf_base model,
const vnl_vector< double > &  mean 
) const [virtual, inherited]

Build default model with given mean.

Implements vpdfl_builder_base.

Definition at line 99 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build ( vpdfl_pdf_base model,
mbl_data_wrapper< vnl_vector< double > > &  data 
) const [virtual, inherited]

Build model from data.

Implements vpdfl_builder_base.

Definition at line 141 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build_adaptive ( vpdfl_kernel_pdf kpdf,
const vnl_vector< double > *  data,
int  n 
) const [inherited]

Build adaptive kernel estimate.

Use equal widths to create a pilot estimate, then use the prob at each data point to modify the widths

Definition at line 262 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build_fixed_width ( vpdfl_kernel_pdf kpdf,
const vnl_vector< double > *  data,
int  n,
double  width 
) const [inherited]

Build from n elements in data[i]. Fixed kernel width.

Build from n elements in data[i].

Definition at line 182 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build_from_array ( vpdfl_pdf_base model,
const vnl_vector< double > *  data,
int  n 
) const [inherited]

Build kernel_pdf from n elements in data[i].

Definition at line 110 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build_select_equal_width ( vpdfl_kernel_pdf kpdf,
const vnl_vector< double > *  data,
int  n 
) const [inherited]

Build from n elements in data[i]. Chooses width.

Same width selected for all points, using $w=(4/(2n+d.n)^{1/(d+4)}\sigma$, as suggested by Silverman Note: This value only suitable for gaussian kernels!

Definition at line 193 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::build_width_from_separation ( vpdfl_kernel_pdf kpdf,
const vnl_vector< double > *  data,
int  n 
) const [inherited]

Kernel width proportional to distance to nearby samples.

Width to nearest neighbour, allowing for repeats.

Definition at line 212 of file vpdfl_kernel_pdf_builder.cxx.

vpdfl_builder_base * vpdfl_gaussian_kernel_pdf_builder::clone ( ) const [virtual]

Create a copy on the heap and return base class pointer.

Implements vpdfl_builder_base.

Definition at line 57 of file vpdfl_gaussian_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::config_from_stream ( vcl_istream &  is) [virtual, inherited]

Read initialisation settings from a stream.

Parameters:

   {
     min_var: 1.0e-6
     // kernel_widths can be fixed_width,select_equal,width_from_sep,adaptive
     kernel_widths: fixed_width
     // Width to be used when it is fixed_width
     fixed_width: 1.0
   }
   
Exceptions:
mbl_exception_parse_errorif the parse fails.

Reimplemented from vpdfl_builder_base.

Definition at line 370 of file vpdfl_kernel_pdf_builder.cxx.

vcl_string vpdfl_gaussian_kernel_pdf_builder::is_a ( ) const [virtual]

Name of the class.

Reimplemented from vpdfl_kernel_pdf_builder.

Definition at line 39 of file vpdfl_gaussian_kernel_pdf_builder.cxx.

bool vpdfl_gaussian_kernel_pdf_builder::is_class ( vcl_string const &  s) const [virtual]

Does the name of the class match the argument?.

Reimplemented from vpdfl_kernel_pdf_builder.

Definition at line 48 of file vpdfl_gaussian_kernel_pdf_builder.cxx.

double vpdfl_kernel_pdf_builder::min_var ( ) const [virtual, inherited]

Get lower threshold on variance for built models.

Implements vpdfl_builder_base.

Definition at line 94 of file vpdfl_kernel_pdf_builder.cxx.

vcl_auto_ptr< vpdfl_builder_base > vpdfl_builder_base::new_builder_from_stream ( vcl_istream &  is) [static, inherited]

Create a vpdfl_builder_base object given a config stream.

Exceptions:
mbl_exceptionif parse error.
vcl_runtime_exceptionif parse error.

This will store the constructed builder.

Incoming properties.

Definition at line 55 of file vpdfl_builder_base.cxx.

vpdfl_pdf_base * vpdfl_gaussian_kernel_pdf_builder::new_model ( ) const [virtual]

Create empty model.

Implements vpdfl_builder_base.

Definition at line 29 of file vpdfl_gaussian_kernel_pdf_builder.cxx.

vcl_auto_ptr< vpdfl_builder_base > vpdfl_builder_base::new_pdf_builder_from_stream ( vcl_istream &  is) [static, inherited]

Create a vpdfl_builder_base object given a config stream (recursive style).

Creates object, then uses config_from_stream(is) to set up internals

Exceptions:
vcl_runtime_exceptionif parse error.

Creates object, then uses config_from_stream(is) to set up internals

Definition at line 145 of file vpdfl_builder_base.cxx.

void vpdfl_kernel_pdf_builder::print_summary ( vcl_ostream &  os) const [virtual, inherited]

Print class to os.

Implements vpdfl_builder_base.

Definition at line 320 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::set_min_var ( double  min_var) [virtual, inherited]

Define lower threshold on variance for built models.

Implements vpdfl_builder_base.

Definition at line 87 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::set_use_adaptive ( ) [inherited]

Build adaptive kernel estimate.

Definition at line 80 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::set_use_equal_width ( ) [inherited]

Use equal width kernels of width depending on number of samples.

Definition at line 68 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::set_use_fixed_width ( double  width) [inherited]

Use fixed width kernels of given width when building.

Definition at line 61 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::set_use_width_from_separation ( ) [inherited]

Kernel width proportional to distance to nearby samples.

Definition at line 74 of file vpdfl_kernel_pdf_builder.cxx.

short vpdfl_kernel_pdf_builder::version_no ( ) const [inherited]

Version number for I/O.

Reimplemented from vpdfl_builder_base.

Definition at line 311 of file vpdfl_kernel_pdf_builder.cxx.

void vpdfl_kernel_pdf_builder::weighted_build ( vpdfl_pdf_base model,
mbl_data_wrapper< vnl_vector< double > > &  data,
const vcl_vector< double > &  wts 
) const [virtual, inherited]

Build model from weighted data.

Implements vpdfl_builder_base.

Definition at line 173 of file vpdfl_kernel_pdf_builder.cxx.


The documentation for this class was generated from the following files: