Public Member Functions | Protected Attributes | Private Attributes
pdf1d_compare_to_pdf_bhat Class Reference

Test if data from a given distribution using Bhattacharyya overlap. More...

#include <pdf1d_compare_to_pdf_bhat.h>

Inheritance diagram for pdf1d_compare_to_pdf_bhat:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 pdf1d_compare_to_pdf_bhat ()
 Dflt ctor.
 pdf1d_compare_to_pdf_bhat (const pdf1d_builder &builder, int n_per_point)
 Construct and define method of building pdf from data.
virtual ~pdf1d_compare_to_pdf_bhat ()
 Destructor.
void set_builder (const pdf1d_builder &)
 Define method of building pdf from data.
const pdf1d_builderbuilder () const
 Method of building pdf from data.
int n_per_point () const
 Number of samples per data-point used in estimating overlap.
void set_n_per_point (int n)
 Number of samples per data-point used in estimating overlap.
virtual double compare (const double *data, int n, const pdf1d_pdf &pdf)
 Test whether data came from the given distribution.
virtual double bootstrap_compare_form (vnl_vector< double > &B, const double *data, int n, const pdf1d_builder &builder, int n_trials)
 Test whether data has form of the given distribution.
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_compare_to_pdfclone () 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.
virtual double bootstrap_compare (vnl_vector< double > &B, const double *data, int n, const pdf1d_pdf &pdf, int n_trials)
 Test whether data came from the given distribution, using bootstrap.
virtual double compare_form (const double *data, int n, const pdf1d_builder &builder)
 Test whether data has form of the given distribution.

Protected Attributes

mbl_cloneable_ptr< pdf1d_pdfpdf_
 Workspace for PDFs.

Private Attributes

mbl_cloneable_ptr< pdf1d_builderbuilder_
 Define method of building pdf from data.
int n_per_point_
 Number of samples per data-point used in estimating overlap.

Detailed Description

Test if data from a given distribution using Bhattacharyya overlap.

Uses builder() to build a pdf from supplied data. This is then tested against the target distribution using an estimate of the Bhattacharyya overlap.

Definition at line 18 of file pdf1d_compare_to_pdf_bhat.h.


Constructor & Destructor Documentation

pdf1d_compare_to_pdf_bhat::pdf1d_compare_to_pdf_bhat ( )

Dflt ctor.

Definition at line 28 of file pdf1d_compare_to_pdf_bhat.cxx.

pdf1d_compare_to_pdf_bhat::pdf1d_compare_to_pdf_bhat ( const pdf1d_builder builder,
int  n_per_point 
)

Construct and define method of building pdf from data.

Parameters:
n_per_point: Number of samples per data-point used in estimating overlap

Definition at line 37 of file pdf1d_compare_to_pdf_bhat.cxx.

pdf1d_compare_to_pdf_bhat::~pdf1d_compare_to_pdf_bhat ( ) [virtual]

Destructor.

Definition at line 49 of file pdf1d_compare_to_pdf_bhat.cxx.


Member Function Documentation

void pdf1d_compare_to_pdf_bhat::b_read ( vsl_b_istream bfs) [virtual]

Load class from binary file stream.

Implements pdf1d_compare_to_pdf.

Definition at line 211 of file pdf1d_compare_to_pdf_bhat.cxx.

void pdf1d_compare_to_pdf_bhat::b_write ( vsl_b_ostream bfs) const [virtual]

Save class to binary file stream.

Implements pdf1d_compare_to_pdf.

Definition at line 200 of file pdf1d_compare_to_pdf_bhat.cxx.

double pdf1d_compare_to_pdf::bootstrap_compare ( vnl_vector< double > &  B,
const double *  data,
int  n,
const pdf1d_pdf pdf,
int  n_trials 
) [virtual, inherited]

Test whether data came from the given distribution, using bootstrap.

Repeatedly resamples n values from data[0..n-1] and compares with the given pdf. Individual comparisons are returned in B.

Returns:
Mean of B

Definition at line 35 of file pdf1d_compare_to_pdf.cxx.

double pdf1d_compare_to_pdf_bhat::bootstrap_compare_form ( vnl_vector< double > &  B,
const double *  data,
int  n,
const pdf1d_builder builder,
int  n_trials 
) [virtual]

Test whether data has form of the given distribution.

Repeatedly resamples n values from data[0..n-1] and calls compare_form(). Individual comparisons are returned in B.

Returns:
Mean of B

Reimplemented from pdf1d_compare_to_pdf.

Definition at line 89 of file pdf1d_compare_to_pdf_bhat.cxx.

const pdf1d_builder& pdf1d_compare_to_pdf_bhat::builder ( ) const [inline]

Method of building pdf from data.

Definition at line 41 of file pdf1d_compare_to_pdf_bhat.h.

pdf1d_compare_to_pdf * pdf1d_compare_to_pdf_bhat::clone ( ) const [virtual]

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

Implements pdf1d_compare_to_pdf.

Definition at line 182 of file pdf1d_compare_to_pdf_bhat.cxx.

double pdf1d_compare_to_pdf_bhat::compare ( const double *  data,
int  n,
const pdf1d_pdf pdf 
) [virtual]

Test whether data came from the given distribution.

Implements pdf1d_compare_to_pdf.

Definition at line 68 of file pdf1d_compare_to_pdf_bhat.cxx.

double pdf1d_compare_to_pdf::compare_form ( const double *  data,
int  n,
const pdf1d_builder builder 
) [virtual, inherited]

Test whether data has form of the given distribution.

Default behaviour is to build pdf from data and then compare data with pdf

Definition at line 64 of file pdf1d_compare_to_pdf.cxx.

vcl_string pdf1d_compare_to_pdf_bhat::is_a ( ) const [virtual]

Name of the class.

Reimplemented from pdf1d_compare_to_pdf.

Definition at line 155 of file pdf1d_compare_to_pdf_bhat.cxx.

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

Does the name of the class match the argument?.

Reimplemented from pdf1d_compare_to_pdf.

Definition at line 164 of file pdf1d_compare_to_pdf_bhat.cxx.

int pdf1d_compare_to_pdf_bhat::n_per_point ( ) const [inline]

Number of samples per data-point used in estimating overlap.

Definition at line 44 of file pdf1d_compare_to_pdf_bhat.h.

void pdf1d_compare_to_pdf_bhat::print_summary ( vcl_ostream &  os) const [virtual]

Print class to os.

Implements pdf1d_compare_to_pdf.

Definition at line 191 of file pdf1d_compare_to_pdf_bhat.cxx.

void pdf1d_compare_to_pdf_bhat::set_builder ( const pdf1d_builder b)

Define method of building pdf from data.

Definition at line 54 of file pdf1d_compare_to_pdf_bhat.cxx.

void pdf1d_compare_to_pdf_bhat::set_n_per_point ( int  n)

Number of samples per data-point used in estimating overlap.

Definition at line 60 of file pdf1d_compare_to_pdf_bhat.cxx.

short pdf1d_compare_to_pdf_bhat::version_no ( ) const

Version number for I/O.

Reimplemented from pdf1d_compare_to_pdf.

Definition at line 173 of file pdf1d_compare_to_pdf_bhat.cxx.


Member Data Documentation

Define method of building pdf from data.

Definition at line 21 of file pdf1d_compare_to_pdf_bhat.h.

Number of samples per data-point used in estimating overlap.

Definition at line 24 of file pdf1d_compare_to_pdf_bhat.h.

Workspace for PDFs.

Definition at line 28 of file pdf1d_compare_to_pdf.h.


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