MeteoIODoc 20241221.207bde49
mio::PolynomialRegression Class Reference

Detailed Description

A class to perform 1D polynomial regression.

Polynomial Regression aims to fit a non-linear relationship to a set of points. It approximates this by solving a series of linear equations using a least-squares approach.

We can model the expected value y as an nth degree polynomial, yielding the general polynomial regression model:

yi = b0 + b1*xi + b2*xi^2 + ... + bm*xi^m, with i=1...n m corresponds to the degree of the polynomial equation n is the number of data points (for fitting)

see https://en.wikipedia.org/wiki/Polynomial_regression

Author
Thiemo Theile
Date
2018-08-20

#include <libfit1D.h>

Public Member Functions

 PolynomialRegression ()
 
 PolynomialRegression (const std::string &i_regname, const size_t &degreeOfRegression)
 
void setData (const std::vector< double > &in_X, const std::vector< double > &in_Y)
 
bool fit ()
 
double f (const double &x) const
 
void setDegree (const size_t &in_degree)
 
- Public Member Functions inherited from mio::FitModel
 FitModel (const std::string &i_regname, const size_t &i_nParam, const size_t &i_min_nb_pts)
 
virtual ~FitModel ()
 
virtual void setData (const std::vector< double > &in_X, const std::vector< double > &in_Y)=0
 
void setGuess (const std::vector< double > &lambda_in)
 
virtual void setLapseRate (const double &)
 
virtual void setDegree (const size_t &)
 
virtual bool fit ()=0
 
virtual double f (const double &x) const =0
 
double operator() (const double &x) const
 
std::vector< double > getParams () const
 
std::string getName () const
 
std::string getInfo () const
 
void setInfo (const std::string &info)
 
FitModeloperator= (const FitModel &source)
 
bool isReady () const
 
std::string toString () const
 

Protected Attributes

size_t degree
 
- Protected Attributes inherited from mio::FitModel
std::vector< double > Lambda
 
std::vector< double > X
 
std::vector< double > Y
 
std::string infoString
 
const std::string regname
 
size_t nPts
 
size_t nParam
 
size_t min_nb_pts
 
bool fit_ready
 

Additional Inherited Members

- Protected Member Functions inherited from mio::FitModel
virtual bool checkInputs ()
 

Constructor & Destructor Documentation

◆ PolynomialRegression() [1/2]

mio::PolynomialRegression::PolynomialRegression ( )
inline

◆ PolynomialRegression() [2/2]

mio::PolynomialRegression::PolynomialRegression ( const std::string &  i_regname,
const size_t &  degreeOfRegression 
)
inline

Member Function Documentation

◆ f()

double mio::PolynomialRegression::f ( const double &  x) const
virtual

Implements mio::FitModel.

◆ fit()

bool mio::PolynomialRegression::fit ( )
virtual

Implements mio::FitModel.

◆ setData()

void mio::PolynomialRegression::setData ( const std::vector< double > &  in_X,
const std::vector< double > &  in_Y 
)
virtual

Implements mio::FitModel.

◆ setDegree()

void mio::PolynomialRegression::setDegree ( const size_t &  in_degree)
inlinevirtual

Reimplemented from mio::FitModel.

Member Data Documentation

◆ degree

size_t mio::PolynomialRegression::degree
protected

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