julian::PolynomialRegression Class Reference

#include <polynomialRegression.hpp>

Inheritance diagram for julian::PolynomialRegression:
julian::DeeplyCopyableRegression< PolynomialRegression > julian::Regression

Public Member Functions

 PolynomialRegression ()
 constructor More...
 
 PolynomialRegression (int order)
 constructor More...
 
void estimate (const std::vector< double > &x, const std::vector< double > &y)
 estimates the parameters basing on provided data More...
 
void estimate (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &w)
 weighted estimates the parameters basing on provided data More...
 
std::vector< double > getCoefficient () const
 return coefficients of the regression More...
 
double operator() (double) const
 evaluates the linear regression model for x More...
 
- Public Member Functions inherited from julian::DeeplyCopyableRegression< PolynomialRegression >
virtual Regressionclone () const
 virtual copy constructor More...
 
- Public Member Functions inherited from julian::Regression
 Regression ()
 Constructor. More...
 
virtual ~Regression ()
 Destructor. More...
 

Private Attributes

int order_
 Order of polynomial. More...
 
std::vector< double > coefs_
 Vector of coefficients. More...
 

Detailed Description

Polynomial regression is regression model with a single explanatory variable. The parameters of the regression are calculated by minimizing the OLS. In other words class computes the best-fit linear regression coefficients $(c_0, c_1, ..., c_n)$ of the model $Y = c_0 + \Sigma^{i=n}_{i=1}c_i x^i$ for the dataset (x, y) by minimizing the sum: $ \sum_i w_i (y_i - \sum_j X_{ij} c_j)^2 = || y - Xc ||_W^2$.

For more information see Wikipedia

Remarks
Class uses algorithm implemented in GSL

Constructor & Destructor Documentation

julian::PolynomialRegression::PolynomialRegression ( )
inline

constructor

Note
If order of polynomial is not given, order of polynomial is set to 2.
julian::PolynomialRegression::PolynomialRegression ( int  order)
inline

constructor

Parameters
orderOrder of polynomial fitted

Member Function Documentation

void julian::PolynomialRegression::estimate ( const std::vector< double > &  x,
const std::vector< double > &  y 
)
virtual

estimates the parameters basing on provided data

Implements julian::Regression.

void julian::PolynomialRegression::estimate ( const std::vector< double > &  x,
const std::vector< double > &  y,
const std::vector< double > &  w 
)

weighted estimates the parameters basing on provided data

std::vector< double > julian::PolynomialRegression::getCoefficient ( ) const
virtual

return coefficients of the regression

The i-th term of vector represents coefficient of i-th power of x

Implements julian::Regression.

double julian::PolynomialRegression::operator() ( double  x) const
virtual

evaluates the linear regression model for x

Implements julian::Regression.

Member Data Documentation

std::vector<double> julian::PolynomialRegression::coefs_
private

Vector of coefficients.

int julian::PolynomialRegression::order_
private

Order of polynomial.


The documentation for this class was generated from the following files:
  • C:/Unix/home/OEM/jULIAN/src/mathematics/regressions/polynomialRegression.hpp
  • C:/Unix/home/OEM/jULIAN/src/mathematics/regressions/polynomialRegression.cpp