Base for objects which perform some form of linear component analysis. More...
#include <mcal_component_analyzer.h>
Public Member Functions | |
mcal_component_analyzer () | |
Dflt ctor. | |
virtual | ~mcal_component_analyzer () |
Destructor. | |
void | compute_mean (mbl_data_wrapper< vnl_vector< double > > &data, vnl_vector< double > &mean) |
Compute the mean of the supplied data. | |
virtual void | build (mbl_data_wrapper< vnl_vector< double > > &data, vnl_vector< double > &mean, vnl_matrix< double > &modes, vnl_vector< double > &mode_var) |
Compute mean and modes from the supplied data. | |
virtual void | build_about_mean (mbl_data_wrapper< vnl_vector< double > > &data, const vnl_vector< double > &mean, vnl_matrix< double > &modes, vnl_vector< double > &mode_var)=0 |
Compute modes of the supplied data relative to the supplied mean. | |
virtual void | build_from_array (const vnl_vector< double > *data, int n, vnl_vector< double > &mean, vnl_matrix< double > &modes, vnl_vector< double > &mode_var) |
Build mean and modes from data in array data[0..n-1]. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const =0 |
Name of the class. | |
virtual mcal_component_analyzer * | clone () const =0 |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const =0 |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const =0 |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs)=0 |
Load class from binary file stream. | |
virtual void | config_from_stream (vcl_istream &) |
Read initialisation settings from a stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < mcal_component_analyzer > | create_from_stream (vcl_istream &is) |
Create a concrete mcal_component_analyzer object, from a text specification. |
Base for objects which perform some form of linear component analysis.
Derived classes (such as mcal_pca) generate linear modes to span the data space so as to optimise certain criteria.
Definition at line 19 of file mcal_component_analyzer.h.
mcal_component_analyzer::mcal_component_analyzer | ( | ) |
Dflt ctor.
Definition at line 14 of file mcal_component_analyzer.cxx.
mcal_component_analyzer::~mcal_component_analyzer | ( | ) | [virtual] |
Destructor.
Definition at line 20 of file mcal_component_analyzer.cxx.
virtual void mcal_component_analyzer::b_read | ( | vsl_b_istream & | bfs | ) | [pure virtual] |
Load class from binary file stream.
Implemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
virtual void mcal_component_analyzer::b_write | ( | vsl_b_ostream & | bfs | ) | const [pure virtual] |
Save class to binary file stream.
Implemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
void mcal_component_analyzer::build | ( | mbl_data_wrapper< vnl_vector< double > > & | data, |
vnl_vector< double > & | mean, | ||
vnl_matrix< double > & | modes, | ||
vnl_vector< double > & | mode_var | ||
) | [virtual] |
Compute mean and modes from the supplied data.
Model is x = mean + modes*b, where b is a vector of weights on each mode. mode_var[i] gives the variance of the data projected onto that mode. Default computes the mean, then calls build_about_mean
Computes the mean, then calls build_about_mean
Definition at line 41 of file mcal_component_analyzer.cxx.
virtual void mcal_component_analyzer::build_about_mean | ( | mbl_data_wrapper< vnl_vector< double > > & | data, |
const vnl_vector< double > & | mean, | ||
vnl_matrix< double > & | modes, | ||
vnl_vector< double > & | mode_var | ||
) | [pure virtual] |
Compute modes of the supplied data relative to the supplied mean.
Model is x = mean + modes*b, where b is a vector of weights on each mode. mode_var[i] gives the variance of the data projected onto that mode.
Implemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
void mcal_component_analyzer::build_from_array | ( | const vnl_vector< double > * | data, |
int | n, | ||
vnl_vector< double > & | mean, | ||
vnl_matrix< double > & | modes, | ||
vnl_vector< double > & | mode_var | ||
) | [virtual] |
Build mean and modes from data in array data[0..n-1].
Utility function - wraps data and uses build(data,mean,modes)
Definition at line 51 of file mcal_component_analyzer.cxx.
virtual mcal_component_analyzer* mcal_component_analyzer::clone | ( | ) | const [pure virtual] |
Create a copy on the heap and return base class pointer.
Implemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
void mcal_component_analyzer::compute_mean | ( | mbl_data_wrapper< vnl_vector< double > > & | data, |
vnl_vector< double > & | mean | ||
) |
Compute the mean of the supplied data.
Definition at line 25 of file mcal_component_analyzer.cxx.
void mcal_component_analyzer::config_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Read initialisation settings from a stream.
The default implementation merely checks that no properties have been specified.
Reimplemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
Definition at line 108 of file mcal_component_analyzer.cxx.
vcl_auto_ptr< mcal_component_analyzer > mcal_component_analyzer::create_from_stream | ( | vcl_istream & | is | ) | [static] |
Create a concrete mcal_component_analyzer object, from a text specification.
Definition at line 84 of file mcal_component_analyzer.cxx.
vcl_string mcal_component_analyzer::is_a | ( | ) | const [pure virtual] |
Name of the class.
Implemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
Definition at line 76 of file mcal_component_analyzer.cxx.
virtual void mcal_component_analyzer::print_summary | ( | vcl_ostream & | os | ) | const [pure virtual] |
Print class to os.
Implemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
short mcal_component_analyzer::version_no | ( | ) | const |
Version number for I/O.
Reimplemented in mcal_pca, mcal_general_ca, and mcal_trivial_ca.
Definition at line 62 of file mcal_component_analyzer.cxx.