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

Definition at line 28 of file vpdfl_mixture_builder.h.
Public Member Functions | |
| vpdfl_mixture_builder () | |
| Dflt ctor. | |
| vpdfl_mixture_builder (const vpdfl_mixture_builder &) | |
| Copy ctor. | |
| vpdfl_mixture_builder & | operator= (const vpdfl_mixture_builder &) |
| Copy operator. | |
| virtual | ~vpdfl_mixture_builder () |
| Destructor. | |
| void | init (const vpdfl_builder_base &builder, int n) |
| Initialise n builders of type builder. | |
| bool | weights_fixed () const |
| Whether weights on components left unchanged during iterations. | |
| void | set_weights_fixed (bool b) |
| Whether weights on components left unchanged during iterations. | |
| void | set_max_iterations (int n) |
| Define maximum number of EM iterations allowed. | |
| int | max_iterations () const |
| Define maximum number of EM iterations allowed. | |
| unsigned | n_builders () const |
| Number of basis builders. | |
| vpdfl_builder_base & | builder (unsigned i) |
| Return i-th builder. | |
| virtual vpdfl_pdf_base * | new_model () const |
| Create empty model. | |
| 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. | |
| 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 | preset_initial_means (const vcl_vector< vnl_vector< double > > &component_means) |
| Preset initial component means. | |
| 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_builder_base * | 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. | |
| virtual void | config_from_stream (vcl_istream &is) |
| Read initialisation settings from a stream. | |
Static Public Member Functions | |
| static void | calc_mean_and_variance (vpdfl_mixture &model) |
| Calculate and set the mixture's mean and variance. | |
| static vcl_auto_ptr< vpdfl_builder_base > | new_builder_from_stream (vcl_istream &is) |
| Create a vpdfl_builder_base object given a config steram. | |
| 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). | |
Private Member Functions | |
| void | initialise_given_means (vpdfl_mixture &model, const vnl_vector< double > *data, const vcl_vector< vnl_vector< double > > &mean, const vcl_vector< double > &wts) const |
| Assumes means set up. Estimates starting components. | |
| void | initialise_to_regular_samples (vpdfl_mixture &model, const vnl_vector< double > *data, const vcl_vector< double > &wts) const |
| Means centred on data[i*f]. | |
| void | initialise_diagonal (vpdfl_mixture &model, const vnl_vector< double > *data, const vcl_vector< double > &wts) const |
| Select positions along diagonal of bounding box. | |
| void | initialise (vpdfl_mixture &model, const vnl_vector< double > *data, const vcl_vector< double > &wts) const |
| Select positions and widths for components to start. | |
| void | e_step (vpdfl_mixture &model, vcl_vector< vnl_vector< double > > &probs, const vnl_vector< double > *data, const vcl_vector< double > &wts) const |
| The Expectation part of the EM algorithm. | |
| double | m_step (vpdfl_mixture &model, const vcl_vector< vnl_vector< double > > &probs, const vnl_vector< double > *data, const vcl_vector< double > &wts) const |
| The Maximisation part of the EM algorithm. | |
| void | init () |
| void | delete_stuff () |
Private Attributes | |
| vcl_vector< vpdfl_builder_base * > | builder_ |
| double | min_var_ |
| int | max_its_ |
| vcl_vector< vnl_vector< double > > | initial_means_ |
| bool | weights_fixed_ |
| Whether weights changed during iterations. | |
|
|
Dflt ctor.
Definition at line 49 of file vpdfl_mixture_builder.cxx. |
|
|
Copy ctor.
Definition at line 56 of file vpdfl_mixture_builder.cxx. |
|
|
Destructor.
Definition at line 95 of file vpdfl_mixture_builder.cxx. |
|
|
Load class from binary file stream.
Implements vpdfl_builder_base. Definition at line 596 of file vpdfl_mixture_builder.cxx. |
|
|
Save class to binary file stream.
Implements vpdfl_builder_base. Definition at line 585 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||
|
Build model from data. Use EM algorithm to best fit mixture model to given data If model does not have the correct number of components they will be initialised to means scattered through the data. If they model has the correct number of components it is assumed that they have been set to sensible initial values. The EM algorithm will be used to optimise their parameters. Implements vpdfl_builder_base. Definition at line 162 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||
|
Build default model with given mean.
Implements vpdfl_builder_base. Definition at line 152 of file vpdfl_mixture_builder.cxx. |
|
|
Return i-th builder.
Definition at line 109 of file vpdfl_mixture_builder.h. |
|
|
Calculate and set the mixture's mean and variance. This should be used after the weights or components of the model have been altered. Definition at line 521 of file vpdfl_mixture_builder.cxx. |
|
|
Create a copy on the heap and return base class pointer.
Implements vpdfl_builder_base. Definition at line 563 of file vpdfl_mixture_builder.cxx. |
|
|
Read initialisation settings from a stream. Parameters: {
min_var: 1.0e-6
// Number of pdf bases to use
n_pdfs: 3
// Type of basis pdf
basis_pdf: axis_gaussian { min_var: 0.0001 }
// Maximum number of iterations
max_its: 10
// When true, fix weights during EM
weights_fixed: false
}
Reimplemented from vpdfl_builder_base. Definition at line 640 of file vpdfl_mixture_builder.cxx. |
|
|
Definition at line 86 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||||||
|
The Expectation part of the EM algorithm.
Definition at line 364 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||
|
Initialise n builders of type builder. Clone taken of builder Definition at line 104 of file vpdfl_mixture_builder.cxx. |
|
|
Definition at line 39 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||
|
Select positions and widths for components to start.
Definition at line 343 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||
|
Select positions along diagonal of bounding box.
Definition at line 290 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||||||
|
Assumes means set up. Estimates starting components.
Definition at line 246 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||
|
Means centred on data[i*f].
Definition at line 321 of file vpdfl_mixture_builder.cxx. |
|
|
Name of the class.
Reimplemented from vpdfl_builder_base. Definition at line 542 of file vpdfl_mixture_builder.cxx. |
|
|
Does the name of the class match the argument?.
Reimplemented from vpdfl_builder_base. Definition at line 549 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||||||
|
The Maximisation part of the EM algorithm.
Definition at line 429 of file vpdfl_mixture_builder.cxx. |
|
|
Define maximum number of EM iterations allowed.
Definition at line 103 of file vpdfl_mixture_builder.h. |
|
|
Get lower threshold on variance for built models.
Implements vpdfl_builder_base. Definition at line 144 of file vpdfl_mixture_builder.cxx. |
|
|
Number of basis builders.
Definition at line 106 of file vpdfl_mixture_builder.h. |
|
|
Create a vpdfl_builder_base object given a config steram.
Definition at line 55 of file vpdfl_builder_base.cxx. |
|
|
Create empty model.
Implements vpdfl_builder_base. Definition at line 128 of file vpdfl_mixture_builder.cxx. |
|
|
Create a vpdfl_builder_base object given a config stream (recursive style). Creates object, then uses config_from_stream(is) to set up internals
Definition at line 145 of file vpdfl_builder_base.cxx. |
|
|
Copy operator.
Definition at line 65 of file vpdfl_mixture_builder.cxx. |
|
|
Preset initial component means. When initialise is called these means will be used as the initial guess Note that the vector must is copied Definition at line 358 of file vpdfl_mixture_builder.cxx. |
|
|
Print class to os.
Implements vpdfl_builder_base. Definition at line 570 of file vpdfl_mixture_builder.cxx. |
|
|
Define maximum number of EM iterations allowed.
Definition at line 115 of file vpdfl_mixture_builder.cxx. |
|
|
Define lower threshold on variance for built models.
Implements vpdfl_builder_base. Definition at line 136 of file vpdfl_mixture_builder.cxx. |
|
|
Whether weights on components left unchanged during iterations.
Definition at line 120 of file vpdfl_mixture_builder.cxx. |
|
|
Version number for I/O.
Reimplemented from vpdfl_builder_base. Definition at line 556 of file vpdfl_mixture_builder.cxx. |
|
||||||||||||||||
|
Build model from weighted data. Use EM algorithm to best fit mixture model to given data If model does not have the correct number of components they will be initialised to means scattered through the data. If they model has the correct number of components it is assumed that they have been set to sensible initial values. The EM algorithm will be used to optimise their parameters. Implements vpdfl_builder_base. Definition at line 172 of file vpdfl_mixture_builder.cxx. |
|
|
Whether weights on components left unchanged during iterations.
Definition at line 94 of file vpdfl_mixture_builder.h. |
|
|
Definition at line 30 of file vpdfl_mixture_builder.h. |
|
|
Definition at line 33 of file vpdfl_mixture_builder.h. |
|
|
Definition at line 32 of file vpdfl_mixture_builder.h. |
|
|
Definition at line 31 of file vpdfl_mixture_builder.h. |
|
|
Whether weights changed during iterations.
Definition at line 36 of file vpdfl_mixture_builder.h. |
1.4.4