BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fitModel.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 //
5 
6 #ifndef BALL_QSAR_FITMODEL
7 #define BALL_QSAR_FITMODEL
8 
9 #ifndef BALL_CONFIG_CONFIG_H
10 # include <BALL/CONFIG/config.h>
11 #endif
12 
13 #ifdef BALL_HAS_GSL
14 
15 #ifndef BALL_QSAR_NONLINEARMODEL_H
17 #endif
18 
19 #include <gsl/gsl_multifit_nlin.h>
20 #include <gsl/gsl_deriv.h>
21 #include <gsl/gsl_math.h>
22 
23 #ifndef BALL_MATHS_PARSEDFUNCTION_H
25 #endif
26 
27 //#include <list>
28 
29 namespace BALL
30 {
31  namespace QSAR
32  {
33  class BALL_EXPORT FitModel : public NonLinearModel
34  {
35  public:
39  FitModel(const QSARData& q);
40 
41  FitModel(const QSARData& q, vector<String>& eq, vector<double>& guess);
42 
43  FitModel(const QSARData& q, vector<String>& eq, vector<vector<String> >& deq, vector<double>& guess);
44 
45  //~FitModel();
47 
48 
55  void setEquations(vector<String>& eq, vector<vector<String> >& deq);
56 
58  void setEquations(vector<String>& eq);
59 
61  void train();
62 
63  Eigen::VectorXd predict(const vector<double>& substance, bool transform=1);
64 
65  void setInitialGuess(vector<double>& d);
67 
68 
69  private:
74  vector<String> allEquations_;
75 
77  vector<vector<String> > allDiffEquations_;
78 
80  //vector<String> allCoefficients;
81 
82  vector<double> initial_guess_;
84 
85  };
86 
87 
88 
89  const Eigen::MatrixXd* fitX;
90  Eigen::MatrixXd* fitY;
91  String* equation;
92  vector<String>* diffEquations;
93  ParsedFunction<double>* f;
94  unsigned int c; // current column
95 
96  double getFunctionValue(double X, void* params);
97 
98  int setF(const gsl_vector* x, void* params, gsl_vector* f);
99 
100  int setDf(const gsl_vector * x, void* params, gsl_matrix * df);
101 
102  int setFdf (const gsl_vector * x, void *params, gsl_vector * f, gsl_matrix * df);
103 
104  gsl_multifit_function_fdf make_fdf (int (* f) (const gsl_vector *, void *, gsl_vector *),
105  int (* df) (const gsl_vector *, void *, gsl_matrix *),
106  int (* fdf) (const gsl_vector *, void *, gsl_vector *, gsl_matrix *),
107  size_t n,
108  size_t p, void * params );
109 
110  }
111 }
112 
113 #endif //BALL_HAS_GSL
114 
115 #endif // BALL_QSAR_FITMODEL
BALL_EXTERN_VARIABLE const double c
Definition: constants.h:149
#define BALL_EXPORT
Definition: COMMON/global.h:50