Public Member Functions | Static Public Member Functions | Private Attributes
mcal_sparse_basis_cost Class Reference

Cost function to promote sparse basis vectors. More...

#include <mcal_sparse_basis_cost.h>

Inheritance diagram for mcal_sparse_basis_cost:
Inheritance graph
[legend]

List of all members.

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_costclone () 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.

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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
   }
   
Exceptions:
mbl_exception_parse_errorif 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
   }
   
Exceptions:
mbl_exception_parse_errorif 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.

Parameters:
[in]unit_basisUnit vector defining basis direction
[in]projectionsProjections 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|.

Parameters:
[in]unit_basisUnit vector defining basis direction
[in]varianceVariance 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.


Member Data Documentation

Weighting for sparseness penalty.

Definition at line 20 of file mcal_sparse_basis_cost.h.


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