polynomialRegression.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_POLYNOMIALREGRESSION_HPP
2 #define JULIAN_POLYNOMIALREGRESSION_HPP
3 
4 #include <vector>
5 #include <iostream>
7 
8 namespace julian {
9 
25  class PolynomialRegression : public DeeplyCopyableRegression<PolynomialRegression> {
26  public:
32 
37  PolynomialRegression(int order): order_(order) {};
38 
39  void estimate(const std::vector<double>& x,const std::vector<double>& y);
40  void estimate(const std::vector<double>& x,const std::vector<double>& y,const std::vector<double>& w);
41 
42  std::vector<double> getCoefficient() const;
43 
44  double operator()(double) const;
45 
46  private:
47  int order_;
48  std::vector<double> coefs_;
49  };
50 }
51 
56 std::ostream& operator<<(std::ostream& s, julian::PolynomialRegression& r);
57 
58 #endif
PolynomialRegression()
constructor
Definition: polynomialRegression.hpp:31
int order_
Order of polynomial.
Definition: polynomialRegression.hpp:47
std::vector< double > coefs_
Vector of coefficients.
Definition: polynomialRegression.hpp:48
Definition: cadHoliday.cpp:3
Definition: polynomialRegression.hpp:25
std::vector< double > getCoefficient() const
return coefficients of the regression
Definition: polynomialRegression.cpp:26
void estimate(const std::vector< double > &x, const std::vector< double > &y)
estimates the parameters basing on provided data
Definition: polynomialRegression.cpp:32
double operator()(double) const
evaluates the linear regression model for x
Definition: polynomialRegression.cpp:11
Class uses Curiously Recurring Template Pattern to implement polymorphic copy construction in every d...
Definition: regression.hpp:60
File contains interface of regressions.
std::ostream & operator<<(std::ostream &s, julian::PolynomialRegression &r)
Overloads stream operator.
Definition: polynomialRegression.cpp:101
PolynomialRegression(int order)
constructor
Definition: polynomialRegression.hpp:37