KrisLibrary  1.0.0
OnlineOLS.h
1 #ifndef STATISTICS_ONLINE_OLS_H
2 #define STATISTICS_ONLINE_OLS_H
3 
4 #include "statistics.h"
5 #include <KrisLibrary/math/LDL.h>
6 
7 namespace Statistics {
8 
16 {
18  void SetPrior(const Vector& coeffs,Real strength);
19  void SetPrior(const Vector& coeffs,const Vector& strength);
20  bool AddPoint(const Vector& data,Real outcome);
21 
22  int numObservations;
23  bool store;
24  std::vector<Vector> data;
25  std::vector<Real> outcome;
26  LDLDecomposition<Real> ldl; //stores the LDL decomposition of AtA
27  Vector Aty; //stores At y
28  Vector coeffs; //stores estimate of coeffs
29 };
30 
54 {
56  void SetPrior(const Vector& coeffs,int strength=1);
57  void AddPoint(const Vector& data,Real outcome);
58 
59  int numObservations;
60  bool store;
61  std::vector<Vector> data;
62  std::vector<Real> outcome;
63 
64  std::vector<Real> weightPolynomial;
65  Vector coeffs; //stores estimate of coeffs
66 };
67 
68 
69 } //namespace Statistics
70 
71 #endif
Stochastic gradient descent estimation of least-squares solution to y = A x.
Definition: OnlineOLS.h:53
Contains all definitions in the statistics directory.
Definition: BernoulliDistribution.h:6
Basic statistical utilities.
Online estimation of least-squares solution to y = A x.
Definition: OnlineOLS.h:15