STK++ 0.9.13
|
Interface base class for Regression methods. More...
#include <STK_IRegression.h>
Public Member Functions | |
virtual | ~IRegression () |
virtual destructor. | |
YArray const & | predicted () const |
YArray const & | residuals () const |
YArray * | p_predicted () |
YArray * | p_residuals () |
int | nbFreeParameter () const |
virtual bool | run () |
run the computations. | |
virtual bool | run (Weights const &weights) |
run the weighted computations. | |
virtual YArray | extrapolate (XArray const &x) const =0 |
![]() | |
virtual void | setX (XArray const &x) |
set the x data set (predictors). | |
virtual void | setY (YArray const &y) |
set the data set. | |
virtual void | setData (YArray const &y, XArray const &x) |
set the data set. | |
![]() | |
String const & | error () const |
get the last error message. | |
Protected Types | |
typedef IRunnerSupervised< YArray, XArray, Weights > | Base |
Protected Member Functions | |
IRegression () | |
Default constructor. | |
IRegression (ArrayBase< YArray > const *p_y, ArrayBase< XArray > const *p_x) | |
constructor | |
IRegression (ArrayBase< YArray > const &y, ArrayBase< XArray > const &x) | |
Constructor. | |
virtual bool | initializeStep () |
perform any computation needed before the call of the regression method. | |
virtual bool | finalizeStep () |
perform any computation needed after the call of the regression method. | |
bool | residualsStep () |
Compute the residuals of the model. | |
![]() | |
IRunnerSupervised () | |
default constructor | |
IRunnerSupervised (YArray const *const &p_y, XArray const *const &p_x) | |
constructor | |
IRunnerSupervised (YArray const &y, XArray const &x) | |
default constructor | |
IRunnerSupervised (IRunnerSupervised const &runner) | |
copy constructor | |
~IRunnerSupervised () | |
destructor | |
virtual void | updateY () |
update the runner when y data set is set. | |
virtual void | updateX () |
update the runner when x data set is set. | |
virtual void | update () |
update the runner. | |
![]() | |
IRunnerBase () | |
default constructor | |
IRunnerBase (IRunnerBase const &runner) | |
copy constructor | |
virtual | ~IRunnerBase () |
destructor | |
Protected Attributes | |
YArray | predicted_ |
Container of the predicted output. | |
YArray | residuals_ |
Container of the residuals. | |
![]() | |
YArray const * | p_y_ |
A pointer on the y data set. | |
XArray const * | p_x_ |
A pointer on the x data set. | |
![]() | |
String | msg_error_ |
String with the last error message. | |
bool | hasRun_ |
true if run has been used, false otherwise | |
Private Member Functions | |
virtual bool | regressionStep ()=0 |
compute the regression function. | |
virtual bool | regressionStep (Weights const &weights)=0 |
compute the weighted regression function. | |
virtual bool | predictionStep ()=0 |
Compute the predicted outputs by the regression function and store the result in the p_predicted_ array. | |
virtual int | computeNbFreeParameter () const =0 |
Compute the number of parameter of the regression function. | |
Private Attributes | |
int | nbFreeParameter_ |
number of parameter of the regression method. | |
Interface base class for Regression methods.
Regression models involve the following variables:
In various fields of application, different terminologies are used in place of dependent and independent variables. A regression model relates Y to a function of X and β.
The approximation is usually formalized as
Assume now that the vector of unknown parameters β is of length k. In order to perform a regression analysis the user must provide information about the dependent variable Y:
In the last case, the regression analysis provides the tools for: #- Finding a solution for unknown parameters β that will, for example, minimize the distance between the measured and predicted values of the dependent variable Y (also known as method of least squares). #- Under certain statistical assumptions, the regression analysis uses the surplus of information to provide statistical information about the unknown parameters β and predicted values of the dependent variable Y.
In this interface, the pure virtual function to implement are
The virtual function
can be overloaded.
Definition at line 107 of file STK_IRegression.h.
|
protected |
Definition at line 110 of file STK_IRegression.h.
|
inlineprotected |
Default constructor.
Initialize the data members.
Definition at line 114 of file STK_IRegression.h.
|
inlineprotected |
constructor
p_y,p_x | pointers on the y and x data sets |
Definition at line 118 of file STK_IRegression.h.
|
inlineprotected |
Constructor.
Initialize the data members.
y,x | arrays with the observed output and inputs of the model |
Definition at line 127 of file STK_IRegression.h.
|
inlinevirtual |
|
privatepure virtual |
Compute the number of parameter of the regression function.
Implemented in STK::AdditiveBSplineRegression< YArray, XArray, Weights >, STK::BSplineRegression< YArray, XVector, Weights >, and STK::MultidimRegression< Array, Weight >.
|
pure virtual |
y
from the value x
using the model. Given the data set x
will compute the values x | the input data set |
Implemented in STK::MultidimRegression< Array, Weight >, and STK::AdditiveBSplineRegression< YArray, XArray, Weights >.
perform any computation needed after the call of the regression method.
Default implementation is do nothing.
Definition at line 172 of file STK_IRegression.h.
Referenced by STK::IMixtureBridge< Derived >::finalizeStep(), STK::MixtureComposer::finalizeStep(), and STK::MixtureLearner::finalizeStep().
perform any computation needed before the call of the regression method.
Default implementation is do nothing.
Reimplemented in STK::AdditiveBSplineRegression< YArray, XArray, Weights >, and STK::BSplineRegression< YArray, XVector, Weights >.
Definition at line 168 of file STK_IRegression.h.
Referenced by STK::MixtureLearner::createLearner().
|
inline |
Definition at line 149 of file STK_IRegression.h.
References STK::IRegression< YArray, XArray, Weights >::nbFreeParameter_.
Referenced by STK::IMixtureStatModel::registerMixture().
|
inline |
Definition at line 144 of file STK_IRegression.h.
References STK::IRegression< YArray, XArray, Weights >::predicted_.
|
inline |
Definition at line 146 of file STK_IRegression.h.
References STK::IRegression< YArray, XArray, Weights >::residuals_.
Definition at line 139 of file STK_IRegression.h.
References STK::IRegression< YArray, XArray, Weights >::predicted_.
Compute the predicted outputs by the regression function and store the result in the p_predicted_ array.
Implemented in STK::AdditiveBSplineRegression< YArray, XArray, Weights >, STK::BSplineRegression< YArray, XVector, Weights >, and STK::MultidimRegression< Array, Weight >.
compute the regression function.
Implemented in STK::AdditiveBSplineRegression< YArray, XArray, Weights >, STK::BSplineRegression< YArray, XVector, Weights >, and STK::MultidimRegression< Array, Weight >.
|
privatepure virtual |
compute the weighted regression function.
weights | the weights of the samples |
Implemented in STK::MultidimRegression< Array, Weight >, STK::AdditiveBSplineRegression< YArray, XArray, Weights >, and STK::BSplineRegression< YArray, XVector, Weights >.
Definition at line 141 of file STK_IRegression.h.
References STK::IRegression< YArray, XArray, Weights >::residuals_.
|
inlineprotected |
Compute the residuals of the model.
The residuals of the model are computed by computing the difference between the observed outputs and the predicted outputs of the model.
Definition at line 177 of file STK_IRegression.h.
References STK::IRunnerSupervised< YArray, XArray, Weights >::p_y_, STK::IRegression< YArray, XArray, Weights >::predicted_, and STK::IRegression< YArray, XArray, Weights >::residuals_.
|
virtual |
run the computations.
Default Implementation.
Implements STK::IRunnerSupervised< YArray, XArray, Weights >.
Definition at line 208 of file STK_IRegression.h.
References STK::MultidimRegression< Array, Weight >::computeNbFreeParameter(), STK::IRegression< Array, Array, Weight >::finalizeStep(), STK::IRunnerBase::hasRun_, STK::IRegression< Array, Array, Weight >::initializeStep(), STK::IRegression< Array, Array, Weight >::nbFreeParameter_, STK::MultidimRegression< Array, Weight >::predictionStep(), STK::MultidimRegression< Array, Weight >::regressionStep(), and STK::IRegression< Array, Array, Weight >::residualsStep().
Referenced by STK::LocalVariance< Array >::computeAxis(), STK::ProjectedVariance< Array >::computeAxis(), STK::LocalVariance< Array >::computeCovarianceMatrices(), STK::LocalVariance< Array >::computeCovarianceMatrices(), STK::AdditiveBSplineRegression< YArray, XArray, Weights >::regressionStep(), STK::AdditiveBSplineRegression< YArray, XArray, Weights >::regressionStep(), STK::WeightedSvd< Array, WRows, WCols >::run(), STK::MultiLeastSquare< ArrayB, ArrayA >::runImpl(), STK::MultiLeastSquare< ArrayB, ArrayA >::runImpl(), and STK::MultiLaw::Normal< RowVector >::setParameters().
run the weighted computations.
run the computations.
weights | weights of the samples |
Default Implementation.
Implements STK::IRunnerSupervised< YArray, XArray, Weights >.
Definition at line 229 of file STK_IRegression.h.
References STK::MultidimRegression< Array, Weight >::computeNbFreeParameter(), STK::IRegression< Array, Array, Weight >::finalizeStep(), STK::IRunnerBase::hasRun_, STK::IRegression< Array, Array, Weight >::initializeStep(), STK::IRegression< Array, Array, Weight >::nbFreeParameter_, STK::MultidimRegression< Array, Weight >::predictionStep(), STK::MultidimRegression< Array, Weight >::regressionStep(), and STK::IRegression< Array, Array, Weight >::residualsStep().
|
private |
number of parameter of the regression method.
Definition at line 190 of file STK_IRegression.h.
Referenced by STK::IRegression< YArray, XArray, Weights >::nbFreeParameter().
|
protected |
Container of the predicted output.
Definition at line 184 of file STK_IRegression.h.
Referenced by STK::IRegression< YArray, XArray, Weights >::p_predicted(), STK::IRegression< YArray, XArray, Weights >::predicted(), and STK::IRegression< YArray, XArray, Weights >::residualsStep().
|
protected |
Container of the residuals.
Definition at line 186 of file STK_IRegression.h.
Referenced by STK::IRegression< YArray, XArray, Weights >::p_residuals(), STK::IRegression< YArray, XArray, Weights >::residuals(), and STK::IRegression< YArray, XArray, Weights >::residualsStep().