32 void setData(
const std::vector<double>& ,
const std::vector<double>& ) {}
33 bool fit() {
return true;}
34 double f(
const double& )
const {
return 0.;}
41 void setData(
const std::vector<double>& in_X,
const std::vector<double>& in_Y);
43 double f(
const double& x)
const;
59 double f(
const double& x)
const;
66 double f(
const double& x)
const;
73 double f(
const double& x)
const;
80 double f(
const double& x)
const;
87 double f(
const double& x)
const;
94 double f(
const double& x)
const;
123 FitModel(i_regname, degreeOfRegression+1, degreeOfRegression+1),
125 void setData(
const std::vector<double>& in_X,
const std::vector<double>& in_Y);
127 double f(
const double& x)
const;
162 typedef enum REGRESSION {
188 Fit1D(
const regression& regType,
const std::vector<double>& in_X,
const std::vector<double>& in_Y,
const bool& updatefit=
true);
197 Fit1D(
const std::string& regType,
const std::vector<double>& in_X,
const std::vector<double>& in_Y,
const bool& updatefit=
true);
215 bool setModel(
const regression& i_regType,
const std::vector<double>& in_X,
const std::vector<double>& in_Y,
const bool& updatefit=
true);
225 bool setModel(
const std::string& i_regType,
const std::vector<double>& in_X,
const std::vector<double>& in_Y,
const bool& updatefit=
true);
263 double f(
const double& x)
const {
return model->
f(x);}
379 FitLinClosedForm() : predictors(), observations(), Beta(), regname(
"MultiLinear"), infoString(), nPreds(0), fit_ready(false) {}
381 void addData(
const std::vector<double>& vecPreds,
const double& obs);
383 double f(
const std::vector<double>& x)
const;
387 std::string
getInfo()
const {
return infoString;}
388 void setInfo(
const std::string& info) {infoString=info;}
393 std::vector< std::vector<double> > predictors;
394 std::vector<double> observations;
396 const std::string regname;
397 std::string infoString;
Definition: libfit1D.h:69
ExpVario()
Definition: libfit1D.h:71
double f(const double &x) const
Definition: libfit1D.cc:297
void setDefaultGuess()
Definition: libfit1D.cc:310
A class to perform 1D regressions.
Definition: libfit1D.h:159
std::string getName() const
Return the name of the fit model.
Definition: libfit1D.h:276
regression
Keywords for regression model.
Definition: libfit1D.h:162
@ NOISY_LINEAR
same as SIMPLE_LINEAR but trying to remove outliers
Definition: libfit1D.h:165
@ SPHERICVARIO
spherical variogram
Definition: libfit1D.h:168
@ RATQUADVARIO
rational quadratic variogram
Definition: libfit1D.h:169
@ QUADRATIC
quadratic
Definition: libfit1D.h:171
@ LINVARIO
linear variogram
Definition: libfit1D.h:166
@ EXPVARIO
exponential variogram
Definition: libfit1D.h:167
@ ZERO
always return zero (this is a way to disable detrending)
Definition: libfit1D.h:163
@ POLYNOMIAL
polynomial regression
Definition: libfit1D.h:172
@ LINEARLS
linear, using least squares
Definition: libfit1D.h:170
@ SIMPLE_LINEAR
basic, cheap linear fit
Definition: libfit1D.h:164
double operator()(const double &x) const
Calculate a value using the computed least square fit. The fit has to be computed before.
Definition: libfit1D.h:301
bool setModel(const regression &i_regType, const std::vector< double > &in_X, const std::vector< double > &in_Y, const bool &updatefit=true)
Set or reset the regression model.
Definition: libfit1D.cc:78
Fit1D & operator=(const Fit1D &source)
Definition: libfit1D.cc:50
Fit1D()
Empty Constructor. The model must be set afterwards. If the model has not been set before calling oth...
Definition: libfit1D.h:179
std::vector< double > getParams() const
Calculate the parameters of the fit. The fit has to be computed before.
Definition: libfit1D.h:270
bool fit()
Compute the regression parameters.
Definition: libfit1D.h:255
void setGuess(const std::vector< double > &lambda_in)
Provide a set of initial values for the model parameters. The model can be used right after providing...
Definition: libfit1D.h:233
~Fit1D()
Definition: libfit1D.h:205
double f(const double &x) const
Calculate a value using the computed least square fit. The fit has to be computed before.
Definition: libfit1D.h:263
void setInfo(const std::string &info)
Set the information string. This is useful to append some extra information to the information string...
Definition: libfit1D.h:291
void setDegree(const size_t °ree)
Set the degree of the polynomial regression This will throw an exception for all other regression mod...
Definition: libfit1D.h:247
std::string toString() const
Definition: libfit1D.h:303
void setLapseRate(const double &lapse_rate)
Set a forced lapse rate for linear regressions This will throw an exception for all other regression ...
Definition: libfit1D.h:240
std::string getInfo() const
Return a string of information about the fit. The fit has to be computed before.
Definition: libfit1D.h:283
A class to perform non-linear least square fitting. It works on a time serie and uses matrix arithmet...
Definition: libfit1DCore.h:74
Definition: libfit1DCore.h:30
bool fit_ready
Definition: libfit1DCore.h:61
std::string getInfo() const
Definition: libfit1DCore.h:44
std::vector< double > getParams() const
Definition: libfit1DCore.cc:30
void setGuess(const std::vector< double > &lambda_in)
Definition: libfit1DCore.cc:37
std::string getName() const
Definition: libfit1DCore.h:43
virtual double f(const double &x) const =0
virtual void setDegree(const size_t &)
Definition: libfit1DCore.h:38
void setInfo(const std::string &info)
Definition: libfit1DCore.h:45
virtual void setLapseRate(const double &)
Definition: libfit1DCore.h:37
size_t nParam
Definition: libfit1DCore.h:59
std::string toString() const
Definition: libfit1DCore.cc:85
size_t min_nb_pts
Definition: libfit1DCore.h:60
Definition: libfit1D.h:62
double f(const double &x) const
Definition: libfit1D.cc:274
void setDefaultGuess()
Definition: libfit1D.cc:286
LinVario()
Definition: libfit1D.h:64
Definition: libfit1D.h:83
void setDefaultGuess()
Definition: libfit1D.cc:350
LinearLS()
Definition: libfit1D.h:85
double f(const double &x) const
Definition: libfit1D.cc:345
This class implements the basic operations on matrices. Elements are access in matrix notation: that ...
Definition: Matrix.h:42
Definition: libfit1D.h:49
bool fit()
Definition: libfit1D.cc:154
NoisyLinear()
Definition: libfit1D.h:51
A class to perform 1D polynomial regression.
Definition: libfit1D.h:118
double f(const double &x) const
Definition: libfit1D.cc:193
size_t degree
Definition: libfit1D.h:130
PolynomialRegression()
Definition: libfit1D.h:121
bool fit()
Definition: libfit1D.cc:202
void setData(const std::vector< double > &in_X, const std::vector< double > &in_Y)
Definition: libfit1D.cc:185
void setDegree(const size_t &in_degree)
Definition: libfit1D.h:128
PolynomialRegression(const std::string &i_regname, const size_t °reeOfRegression)
Definition: libfit1D.h:122
Definition: libfit1D.h:90
double f(const double &x) const
Definition: libfit1D.cc:362
void setDefaultGuess()
Definition: libfit1D.cc:367
Quadratic()
Definition: libfit1D.h:92
Definition: libfit1D.h:76
void setDefaultGuess()
Definition: libfit1D.cc:334
RatQuadVario()
Definition: libfit1D.h:78
double f(const double &x) const
Definition: libfit1D.cc:321
Definition: libfit1D.h:37
bool fit()
Definition: libfit1D.cc:122
SimpleLinear()
Definition: libfit1D.h:39
void setLapseRate(const double &in_lapse_rate)
Definition: libfit1D.h:44
double f(const double &x) const
Definition: libfit1D.cc:118
SimpleLinear(const std::string &i_regname)
Definition: libfit1D.h:40
double fixed_lapse_rate
Definition: libfit1D.h:46
void setData(const std::vector< double > &in_X, const std::vector< double > &in_Y)
Definition: libfit1D.cc:111
Definition: libfit1D.h:55
SphericVario()
Definition: libfit1D.h:57
double f(const double &x) const
Definition: libfit1D.cc:251
void setDefaultGuess()
Definition: libfit1D.cc:268
Definition: libfit1D.h:29
Zero()
Definition: libfit1D.h:31
double f(const double &) const
Definition: libfit1D.h:34
bool fit()
Definition: libfit1D.h:33
void setData(const std::vector< double > &, const std::vector< double > &)
Definition: libfit1D.h:32
const double nodata
This is the internal nodata value.
Definition: IOUtils.h:75