DGtal
1.5.beta
|
Description of class 'OrderedLinearRegression'. More...
#include <DGtal/math/OrderedLinearRegression.h>
Public Member Functions | |
~OrderedLinearRegression () | |
OrderedLinearRegression (double eps_zero=1e-8) | |
void | clear () |
template<class XIterator , class YIterator > | |
void | addSamples (XIterator begin_x, XIterator end_x, YIterator begin_y) |
void | addSample (const double x, const double y) |
void | forwardSLR (SimpleLinearRegression &linearModel, const unsigned int n=4, const double alpha=0.01) const |
void | backwardSLR (SimpleLinearRegression &linearModel, const unsigned int n=4, const double alpha=0.01) const |
void | selfDisplay (std::ostream &that_stream) const |
bool | isValid () const |
Private Member Functions | |
OrderedLinearRegression (const OrderedLinearRegression &other) | |
OrderedLinearRegression & | operator= (const OrderedLinearRegression &other) |
Private Attributes | |
double | myEpsilonZero |
Epsilon zero value. More... | |
unsigned int | myN |
Number of samples. More... | |
std::vector< double > | myY |
Ordinate values of sample points. More... | |
std::vector< double > | myX |
Abscissa values of sample points. More... | |
Description of class 'OrderedLinearRegression'.
Aim: Utility based on SimpleLinearRegression to compute regression on ordered data. Hence, we can obtain linear fitting with interval trust from the left to the right (resp. from the right to the left) of the data.
Definition at line 65 of file OrderedLinearRegression.h.
|
inline |
|
inline |
Constructor. The object is empty (and invalid for regression).
[in] | eps_zero | the value below which the absolute value of the determinant is considered null. |
Definition at line 83 of file OrderedLinearRegression.h.
|
private |
Copy constructor.
other | the object to clone. Forbidden by default. |
|
inline |
Adds the sample (x,y). Does not compute immediately the regression but copies the data. See 'forwardSLR' or 'backwardSLR' for computing the regression with the current samples.
[in] | x | the x data. |
[in] | y | the y data. |
Definition at line 131 of file OrderedLinearRegression.h.
Referenced by addSamples().
|
inline |
Adds the samples (x,y). Does not compute immediately the regression but copies the data. See 'forwardSLR' or 'backwardSLR' for computing the regression with the current samples.
[in] | begin_x | an iterator on the first x-data |
[in] | end_x | an iterator after the last x-data |
[in] | begin_y | an iterator on the first y-data |
Definition at line 111 of file OrderedLinearRegression.h.
References addSample().
Referenced by testSimpleRegressionOrdered().
|
inline |
Returns the slope of the last straight part of the data. The straightness is evaluated through a statistic test based on a simple linear regression (SLR) model. It requires two parameters: n is the minimum number of samples to fit a linear model, 1-[ alpha] is the proportion of accepted linear model of the test (99%, alpha=0.01, means that 99% of all linear model with a Gaussian noise are accepted).
[in] | n | the minimum number of samples greater than 3 (default value is 4). |
[in] | alpha | is the proportion of rejected linear model (the ones with big variance, default value is 0.01). |
[out] | linearModel | the SLR instance of the last straight part of the data. |
Definition at line 200 of file OrderedLinearRegression.h.
References DGtal::SimpleLinearRegression::addSample(), DGtal::SimpleLinearRegression::addSamples(), DGtal::SimpleLinearRegression::clear(), DGtal::SimpleLinearRegression::computeRegression(), myEpsilonZero, myX, myY, DGtal::SimpleLinearRegression::setEpsilonZero(), and DGtal::SimpleLinearRegression::trustIntervalForY().
Referenced by testSimpleRegressionOrdered().
|
inline |
|
inline |
Returns the slope of the first straight part of the data. The straightness is evaluated through a statistic test based on a simple linear regression (SLR) model. It requires two parameters: n is the minimum number of samples to fit a linear model, 1-[ alpha] is the proportion of accepted linear model of the test (99%, alpha=0.01, means that 99% of all linear model with a Gaussian noise are accepted).
[in] | n | the minimum number of samples greater than 3 (default value is 4). |
[in] | alpha | is the proportion of rejected linear model (the ones with big variance, default value is 0.01). |
[out] | linearModel | the SLR instance of the first straight part of the data. |
Definition at line 157 of file OrderedLinearRegression.h.
References DGtal::SimpleLinearRegression::addSample(), DGtal::SimpleLinearRegression::addSamples(), DGtal::SimpleLinearRegression::clear(), DGtal::SimpleLinearRegression::computeRegression(), myEpsilonZero, myX, myY, DGtal::SimpleLinearRegression::setEpsilonZero(), and DGtal::SimpleLinearRegression::trustIntervalForY().
Referenced by testSimpleRegressionOrdered().
|
inline |
Checks the validity/consistency of the object.
Definition at line 241 of file OrderedLinearRegression.h.
|
private |
Assignment.
other | the object to copy. |
|
inline |
Writes/Displays the object on an output stream.
that_stream | the output stream where the object is written. |
Definition at line 232 of file OrderedLinearRegression.h.
References myN.
|
private |
Epsilon zero value.
Definition at line 252 of file OrderedLinearRegression.h.
Referenced by backwardSLR(), and forwardSLR().
|
private |
Number of samples.
Definition at line 255 of file OrderedLinearRegression.h.
Referenced by addSample(), clear(), and selfDisplay().
|
private |
Abscissa values of sample points.
Definition at line 261 of file OrderedLinearRegression.h.
Referenced by addSample(), backwardSLR(), clear(), and forwardSLR().
|
private |
Ordinate values of sample points.
Definition at line 258 of file OrderedLinearRegression.h.
Referenced by addSample(), backwardSLR(), clear(), and forwardSLR().