robustRegression.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_ROBUSTREGRESSION_HPP
2 #define JULIAN_ROBUSTREGRESSION_HPP
3 
4 #include <vector>
5 #include <iostream>
7 
8 namespace julian {
9 
65  class RobustRegression : public DeeplyCopyableRegression<RobustRegression> {
66  public:
67 
70  enum type {BISQUARE,
72  FAIR,
74  OLS,
76  };
77 
83 
86  RobustRegression(int order, RobustRegression::type t): order_(order), type_(t) {};
87 
88  void estimate(const std::vector<double>& x,const std::vector<double>& y);
89 
90  std::vector<double> getCoefficient() const;
91  double operator()(double) const;
92 
93  virtual ~RobustRegression(){}
94 
95  private:
96  int order_;
98  std::vector<double> coefs_;
99  };
100 
101 }
106 std::ostream& operator<<(std::ostream& s, julian::RobustRegression& r);
107 
108 #endif
Welsch function.
Definition: robustRegression.hpp:75
std::vector< double > getCoefficient() const
return coefficients of the regression
Definition: robustRegression.cpp:69
Tukey&#39;s bi-square function.
Definition: robustRegression.hpp:70
OLS.
Definition: robustRegression.hpp:74
void estimate(const std::vector< double > &x, const std::vector< double > &y)
estimates the parameters basing on provided data
Definition: robustRegression.cpp:9
Definition: cadHoliday.cpp:3
type
Robust regression types.
Definition: robustRegression.hpp:70
std::ostream & operator<<(std::ostream &s, julian::RobustRegression &r)
Overloads stream operator.
Definition: robustRegression.cpp:75
RobustRegression()
constructor
Definition: robustRegression.hpp:82
RobustRegression::type type_
Type of robust regression.
Definition: robustRegression.hpp:97
Fair regression.
Definition: robustRegression.hpp:72
int order_
Order of polynomial.
Definition: robustRegression.hpp:96
Huber loss function.
Definition: robustRegression.hpp:73
Class uses Curiously Recurring Template Pattern to implement polymorphic copy construction in every d...
Definition: regression.hpp:60
double operator()(double) const
Operator performing calculation.
Definition: robustRegression.cpp:57
std::vector< double > coefs_
Vector of coefficients.
Definition: robustRegression.hpp:98
RobustRegression(int order, RobustRegression::type t)
constructor
Definition: robustRegression.hpp:86
Cauchy’s function.
Definition: robustRegression.hpp:71
File contains interface of regressions.
Class implements robust linear regression.
Definition: robustRegression.hpp:65