Public Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes
rrel_irls Class Reference

Iteratively-reweighted least-squares minimization of an M-estimator. More...

#include <rrel_irls.h>

List of all members.

Public Member Functions

 rrel_irls (int max_iterations=dflt_max_iterations_)
 Constructor.
 ~rrel_irls ()
 Destructor.
void set_est_scale (int iterations_for_scale=dflt_iterations_for_scale_, bool use_weighted_scale=false)
 Set scale estimation and parameters.
void set_scale_lower_bound (double lower_scale)
 Set lower bound of scale estimate.
void set_no_scale_est ()
 Set for no scale estimation.
void initialize_scale (double scale)
 Initialize the scale value.
void reset_scale ()
 Indicate that scale has not been initialized.
double scale () const
 Get the scale estimate (or the fixed scale value).
void set_max_iterations (int max_iterations=dflt_max_iterations_)
 Set the maximum number of iterations.
void set_convergence_test (double convergence_tol=dflt_convergence_tol_)
 Indicate that a convergence test is to be used.
void set_no_convergence_test ()
 Indicate that no convergence test is to be used.
void initialize_params (const vnl_vector< double > &init_params)
 Initialize the parameter estimate.
void reset_params ()
 Reset the parameters.
void set_trace_level (int level)
bool estimate (const rrel_estimation_problem *problem, const rrel_wls_obj *m_estimator)
 Estimate the parameters.
const vnl_vector< double > & params () const
 Get the parameter estimate.
const vnl_matrix< double > & cofactor () const
 Get the cofactor matrix (the covariance matrix / scale^2).
bool converged () const
 Determine if the estimation converged.
int iterations_used () const
 The number of iterations that were used.
void trace_residuals (const vcl_vector< double > &residuals) const
 Print the residuals. Used for debugging.
void trace_weights (const vcl_vector< double > &weights) const
 Print the IRLS weights. Used for debugging.
void print_params () const
 Print the set of parameters.

Protected Attributes

int max_iterations_
bool test_converge_
double convergence_tol_
bool est_scale_during_
bool use_weighted_scale_
int iterations_for_scale_est_
double scale_lower_bound_
int trace_level_
vnl_vector< double > params_
vnl_matrix< double > cofact_
bool params_initialized_
double scale_
bool scale_initialized_
double obj_fcn_
double prev_obj_fcn_
bool converged_
int iteration_

Private Member Functions

bool has_converged (const vcl_vector< double > &residuals, const rrel_wls_obj *m_estimator, const rrel_estimation_problem *problem, vnl_vector< double > *params)

Static Private Attributes

static const double dflt_convergence_tol_ = 1e-4
static const int dflt_max_iterations_ = 25
static const int dflt_iterations_for_scale_ = 1

Detailed Description

Iteratively-reweighted least-squares minimization of an M-estimator.

IRLS is a search technique for solving M-estimation problems. The technique is to compute weights from a given parameter estimate, and use those weights to compute a new estimate via weighted least squares.

Several options allow variation in the behavior of estimation:

(1) Scale may be fixed through a parameter setting function or it may be estimated in the first few iterations of IRLS. A parameter called iterations_for_scale_est_ determines the number of iterations during which scale is to be estimated. Scale estimation is either weight-based or median-based.

(2) The maximum number of iterations may be set, either in the constructor or through parameter setting member functions.

(3) The convergence test, which is based on the objective function, may or may not be run. Not running it makes each iteration faster, but may result in more iterations than necessary. The convergence test is not applied until the scale is no longer allowed to change. (The alternative, which was not implemented, is to include a ln(sigma) term to the objective function.)

(4) The parameters, the scale, both or neither may be initialized.

See also rrel_estimation_problem and rrel_wls_obj.

Definition at line 49 of file rrel_irls.h.


Constructor & Destructor Documentation

rrel_irls::rrel_irls ( int  max_iterations = dflt_max_iterations_)

Constructor.

Definition at line 23 of file rrel_irls.cxx.

rrel_irls::~rrel_irls ( ) [inline]

Destructor.

Definition at line 61 of file rrel_irls.h.


Member Function Documentation

const vnl_matrix< double > & rrel_irls::cofactor ( ) const

Get the cofactor matrix (the covariance matrix / scale^2).

Definition at line 252 of file rrel_irls.cxx.

bool rrel_irls::converged ( ) const [inline]

Determine if the estimation converged.

Definition at line 145 of file rrel_irls.h.

bool rrel_irls::estimate ( const rrel_estimation_problem problem,
const rrel_wls_obj m_estimator 
)

Estimate the parameters.

The initial step is to initialize the parameter estimate, if necessary, and then the scale estimate, if necessary. Then the following basic loop is applied:

1. Calculate residuals 2. Test for convergence, if desired. 3. Calculate weights 4. Calculate scale 5. Calculate new estimate

The loop can end in one of three ways: (a) convergence, (b) the maximum number of iterations is reached, (c) the weighted least-squares estimate fails.

Definition at line 118 of file rrel_irls.cxx.

bool rrel_irls::has_converged ( const vcl_vector< double > &  residuals,
const rrel_wls_obj m_estimator,
const rrel_estimation_problem problem,
vnl_vector< double > *  params 
) [private]

Definition at line 269 of file rrel_irls.cxx.

void rrel_irls::initialize_params ( const vnl_vector< double > &  init_params)

Initialize the parameter estimate.

Definition at line 110 of file rrel_irls.cxx.

void rrel_irls::initialize_scale ( double  scale)

Initialize the scale value.

Definition at line 66 of file rrel_irls.cxx.

int rrel_irls::iterations_used ( ) const

The number of iterations that were used.

Definition at line 261 of file rrel_irls.cxx.

const vnl_vector< double > & rrel_irls::params ( ) const

Get the parameter estimate.

Definition at line 243 of file rrel_irls.cxx.

void rrel_irls::print_params ( ) const

Print the set of parameters.

Definition at line 321 of file rrel_irls.cxx.

void rrel_irls::reset_params ( ) [inline]

Reset the parameters.

Definition at line 109 of file rrel_irls.h.

void rrel_irls::reset_scale ( ) [inline]

Indicate that scale has not been initialized.

Definition at line 82 of file rrel_irls.h.

double rrel_irls::scale ( ) const

Get the scale estimate (or the fixed scale value).

Definition at line 74 of file rrel_irls.cxx.

void rrel_irls::set_convergence_test ( double  convergence_tol = dflt_convergence_tol_)

Indicate that a convergence test is to be used.

Definition at line 92 of file rrel_irls.cxx.

void rrel_irls::set_est_scale ( int  iterations_for_scale = dflt_iterations_for_scale_,
bool  use_weighted_scale = false 
)

Set scale estimation and parameters.

Definition at line 38 of file rrel_irls.cxx.

void rrel_irls::set_max_iterations ( int  max_iterations = dflt_max_iterations_)

Set the maximum number of iterations.

Definition at line 83 of file rrel_irls.cxx.

void rrel_irls::set_no_convergence_test ( )

Indicate that no convergence test is to be used.

Definition at line 102 of file rrel_irls.cxx.

void rrel_irls::set_no_scale_est ( )

Set for no scale estimation.

Scale must be initialized or supplied by the problem.

Definition at line 59 of file rrel_irls.cxx.

void rrel_irls::set_scale_lower_bound ( double  lower_scale)

Set lower bound of scale estimate.

Definition at line 52 of file rrel_irls.cxx.

void rrel_irls::set_trace_level ( int  level) [inline]

Definition at line 111 of file rrel_irls.h.

void rrel_irls::trace_residuals ( const vcl_vector< double > &  residuals) const

Print the residuals. Used for debugging.

Definition at line 301 of file rrel_irls.cxx.

void rrel_irls::trace_weights ( const vcl_vector< double > &  weights) const

Print the IRLS weights. Used for debugging.

Definition at line 311 of file rrel_irls.cxx.


Member Data Documentation

vnl_matrix<double> rrel_irls::cofact_ [protected]

Definition at line 178 of file rrel_irls.h.

bool rrel_irls::converged_ [protected]

Definition at line 183 of file rrel_irls.h.

double rrel_irls::convergence_tol_ [protected]

Definition at line 169 of file rrel_irls.h.

const double rrel_irls::dflt_convergence_tol_ = 1e-4 [static, private]

Definition at line 52 of file rrel_irls.h.

const int rrel_irls::dflt_iterations_for_scale_ = 1 [static, private]

Definition at line 54 of file rrel_irls.h.

const int rrel_irls::dflt_max_iterations_ = 25 [static, private]

Definition at line 53 of file rrel_irls.h.

bool rrel_irls::est_scale_during_ [protected]

Definition at line 170 of file rrel_irls.h.

int rrel_irls::iteration_ [protected]

Definition at line 184 of file rrel_irls.h.

Definition at line 172 of file rrel_irls.h.

int rrel_irls::max_iterations_ [protected]

Definition at line 167 of file rrel_irls.h.

double rrel_irls::obj_fcn_ [protected]

Definition at line 182 of file rrel_irls.h.

vnl_vector<double> rrel_irls::params_ [protected]

Definition at line 177 of file rrel_irls.h.

Definition at line 179 of file rrel_irls.h.

double rrel_irls::prev_obj_fcn_ [protected]

Definition at line 182 of file rrel_irls.h.

double rrel_irls::scale_ [protected]

Definition at line 180 of file rrel_irls.h.

Definition at line 181 of file rrel_irls.h.

double rrel_irls::scale_lower_bound_ [protected]

Definition at line 173 of file rrel_irls.h.

bool rrel_irls::test_converge_ [protected]

Definition at line 168 of file rrel_irls.h.

int rrel_irls::trace_level_ [protected]

Definition at line 174 of file rrel_irls.h.

Definition at line 171 of file rrel_irls.h.


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