Do the regression fitting for a given basis instance. More...
#include <mbl_stepwise_regression.h>
Public Member Functions | |
lsfit_this_basis (const vnl_matrix< double > &x, const vnl_vector< double > &y, const vnl_matrix< double > &XtX, const vnl_vector< double > &XtY) | |
constructor, note supply the data references. | |
void | set_basis (vcl_set< unsigned > &basis) |
Set the basis. | |
const vcl_set< unsigned > & | basis () const |
return the basis. | |
double | add (unsigned k) |
Try adding variable k to the basis and then fit the extended basis, returning resid sum of squares. | |
double | remove (unsigned k) |
Try removing variable k from the basis and then fit the extended basis, returning resid sum of squares. | |
double | operator() () |
Fit the current basis. | |
const vnl_vector< double > & | weights () const |
return the regression coefficients and constant (final term). | |
Private Attributes | |
const vnl_matrix< double > & | x_ |
The data matrix of x values (predictor variables). | |
const vnl_vector< double > & | y_ |
Vector of dependent y values. | |
const vnl_matrix< double > & | XtX_ |
x'x. | |
const vnl_vector< double > & | XtY_ |
x'y. | |
vcl_set< unsigned > | basis_ |
the basis (note ordered by variable index). | |
unsigned | num_examples_ |
number of training examples (i.e. number of rows in x_). | |
unsigned | num_vars_ |
dimensionality - (i.e. number of columns in x_). | |
vnl_vector< double > | weights_ |
The regression coefficients determine for the significant variables in the basis. |
Do the regression fitting for a given basis instance.
Definition at line 104 of file mbl_stepwise_regression.h.
mbl_stepwise_regression_helpers::lsfit_this_basis::lsfit_this_basis | ( | const vnl_matrix< double > & | x, |
const vnl_vector< double > & | y, | ||
const vnl_matrix< double > & | XtX, | ||
const vnl_vector< double > & | XtY | ||
) | [inline] |
constructor, note supply the data references.
Definition at line 127 of file mbl_stepwise_regression.h.
double mbl_stepwise_regression_helpers::lsfit_this_basis::add | ( | unsigned | k | ) |
Try adding variable k to the basis and then fit the extended basis, returning resid sum of squares.
Note the basis is not actually updated, only temporarily for the duration of this call
Definition at line 234 of file mbl_stepwise_regression.cxx.
const vcl_set<unsigned>& mbl_stepwise_regression_helpers::lsfit_this_basis::basis | ( | ) | const [inline] |
return the basis.
Definition at line 139 of file mbl_stepwise_regression.h.
double mbl_stepwise_regression_helpers::lsfit_this_basis::operator() | ( | ) |
Fit the current basis.
Definition at line 250 of file mbl_stepwise_regression.cxx.
double mbl_stepwise_regression_helpers::lsfit_this_basis::remove | ( | unsigned | k | ) |
Try removing variable k from the basis and then fit the extended basis, returning resid sum of squares.
Note the basis is not actually updated, only temporarily for the duration of this call
Definition at line 242 of file mbl_stepwise_regression.cxx.
void mbl_stepwise_regression_helpers::lsfit_this_basis::set_basis | ( | vcl_set< unsigned > & | basis | ) | [inline] |
Set the basis.
Definition at line 137 of file mbl_stepwise_regression.h.
const vnl_vector<double >& mbl_stepwise_regression_helpers::lsfit_this_basis::weights | ( | ) | const [inline] |
return the regression coefficients and constant (final term).
Definition at line 153 of file mbl_stepwise_regression.h.
vcl_set<unsigned> mbl_stepwise_regression_helpers::lsfit_this_basis::basis_ [private] |
the basis (note ordered by variable index).
Definition at line 116 of file mbl_stepwise_regression.h.
unsigned mbl_stepwise_regression_helpers::lsfit_this_basis::num_examples_ [private] |
number of training examples (i.e. number of rows in x_).
Definition at line 118 of file mbl_stepwise_regression.h.
unsigned mbl_stepwise_regression_helpers::lsfit_this_basis::num_vars_ [private] |
dimensionality - (i.e. number of columns in x_).
Definition at line 120 of file mbl_stepwise_regression.h.
vnl_vector<double> mbl_stepwise_regression_helpers::lsfit_this_basis::weights_ [private] |
The regression coefficients determine for the significant variables in the basis.
NB These are in the order of the basis variables, e.g. weights_[1] is for the second variable Also note the size of weights is one more than the basis, the last term being the constant
Definition at line 124 of file mbl_stepwise_regression.h.
const vnl_matrix<double>& mbl_stepwise_regression_helpers::lsfit_this_basis::x_ [private] |
The data matrix of x values (predictor variables).
Each training example is a row, each x-variable dimension corresponds to a column
Definition at line 108 of file mbl_stepwise_regression.h.
const vnl_matrix<double>& mbl_stepwise_regression_helpers::lsfit_this_basis::XtX_ [private] |
x'x.
Definition at line 112 of file mbl_stepwise_regression.h.
const vnl_vector<double>& mbl_stepwise_regression_helpers::lsfit_this_basis::XtY_ [private] |
x'y.
Definition at line 114 of file mbl_stepwise_regression.h.
const vnl_vector<double>& mbl_stepwise_regression_helpers::lsfit_this_basis::y_ [private] |
Vector of dependent y values.
Definition at line 110 of file mbl_stepwise_regression.h.