Cost function to promote sparse basis vectors. More...
#include <mcal_sparse_basis_cost.h>
Public Member Functions | |
mcal_sparse_basis_cost () | |
Dflt ctor. | |
virtual | ~mcal_sparse_basis_cost () |
Destructor. | |
double | alpha () const |
Weighting for sparseness penalty. | |
void | set_alpha (double a) |
Weighting for sparseness penalty. | |
virtual bool | can_use_variance () const |
Returns true since cost can be computed from the variance. | |
virtual double | cost (const vnl_vector< double > &unit_basis, const vnl_vector< double > &projections) |
Compute component of the cost function from given basis vector. | |
virtual double | cost_from_variance (const vnl_vector< double > &unit_basis, double variance) |
Compute component of the cost function from given basis vector. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual mcal_single_basis_cost * | 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 vcl_auto_ptr < mcal_single_basis_cost > | create_from_stream (vcl_istream &is) |
Create a concrete mcal_single_basis_cost object, from a text specification. | |
Private Attributes | |
double | alpha_ |
Weighting for sparseness penalty. |
Cost function to promote sparse basis vectors.
Cost is log(variance) + alpha sum |e_i|, which encourages concentration in non-zero elements of the basis vector
Definition at line 16 of file mcal_sparse_basis_cost.h.
mcal_sparse_basis_cost::mcal_sparse_basis_cost | ( | ) |
Dflt ctor.
Definition at line 23 of file mcal_sparse_basis_cost.cxx.
mcal_sparse_basis_cost::~mcal_sparse_basis_cost | ( | ) | [virtual] |
Destructor.
Definition at line 32 of file mcal_sparse_basis_cost.cxx.
double mcal_sparse_basis_cost::alpha | ( | ) | const [inline] |
Weighting for sparseness penalty.
Definition at line 31 of file mcal_sparse_basis_cost.h.
void mcal_sparse_basis_cost::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements mcal_single_basis_cost.
Definition at line 119 of file mcal_sparse_basis_cost.cxx.
void mcal_sparse_basis_cost::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements mcal_single_basis_cost.
Definition at line 109 of file mcal_sparse_basis_cost.cxx.
bool mcal_sparse_basis_cost::can_use_variance | ( | ) | const [virtual] |
Returns true since cost can be computed from the variance.
Implements mcal_single_basis_cost.
Definition at line 43 of file mcal_sparse_basis_cost.cxx.
mcal_single_basis_cost * mcal_sparse_basis_cost::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements mcal_single_basis_cost.
Definition at line 91 of file mcal_sparse_basis_cost.cxx.
void mcal_sparse_basis_cost::config_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Read initialisation settings from a stream.
Parameters:
{ alpha: 1.0 }
mbl_exception_parse_error | if the parse fails. |
Parameters:
{ min_modes: 0 max_modes: 99 prop_modes: 0.99 // Maximum number of doubles to store in memory at once max_d_in_memory: 1e8 // Indicate how to build from large amounts of data use_chunks: false }
mbl_exception_parse_error | if the parse fails. |
Reimplemented from mcal_single_basis_cost.
Definition at line 148 of file mcal_sparse_basis_cost.cxx.
double mcal_sparse_basis_cost::cost | ( | const vnl_vector< double > & | unit_basis, |
const vnl_vector< double > & | projections | ||
) | [virtual] |
Compute component of the cost function from given basis vector.
[in] | unit_basis | Unit vector defining basis direction |
[in] | projections | Projections of the dataset onto this basis vector |
Implements mcal_single_basis_cost.
Definition at line 51 of file mcal_sparse_basis_cost.cxx.
double mcal_sparse_basis_cost::cost_from_variance | ( | const vnl_vector< double > & | unit_basis, |
double | variance | ||
) | [virtual] |
Compute component of the cost function from given basis vector.
Cost is log(variance) + alpha sum |e_i|.
[in] | unit_basis | Unit vector defining basis direction |
[in] | variance | Variance of projections of the dataset onto this basis vector |
Implements mcal_single_basis_cost.
Definition at line 62 of file mcal_sparse_basis_cost.cxx.
vcl_auto_ptr< mcal_single_basis_cost > mcal_single_basis_cost::create_from_stream | ( | vcl_istream & | is | ) | [static, inherited] |
Create a concrete mcal_single_basis_cost object, from a text specification.
Definition at line 48 of file mcal_single_basis_cost.cxx.
vcl_string mcal_sparse_basis_cost::is_a | ( | ) | const [virtual] |
Name of the class.
Implements mcal_single_basis_cost.
Definition at line 73 of file mcal_sparse_basis_cost.cxx.
void mcal_sparse_basis_cost::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements mcal_single_basis_cost.
Definition at line 100 of file mcal_sparse_basis_cost.cxx.
void mcal_sparse_basis_cost::set_alpha | ( | double | a | ) |
Weighting for sparseness penalty.
Definition at line 37 of file mcal_sparse_basis_cost.cxx.
short mcal_sparse_basis_cost::version_no | ( | ) | const |
Version number for I/O.
Reimplemented from mcal_single_basis_cost.
Definition at line 82 of file mcal_sparse_basis_cost.cxx.
double mcal_sparse_basis_cost::alpha_ [private] |
Weighting for sparseness penalty.
Definition at line 20 of file mcal_sparse_basis_cost.h.