BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fitModel.h
Go to the documentation of this file.
1 /* fitModel.h
2  *
3  * Copyright (C) 2009 Marcel Schumann
4  *
5  * This file is part of QuEasy -- A Toolbox for Automated QSAR Model
6  * Construction and Validation.
7  * QuEasy is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or (at
10  * your option) any later version.
11  *
12  * QuEasy is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 // -*- Mode: C++; tab-width: 2; -*-
22 // vi: set ts=2:
23 //
24 //
25 
26 #ifndef FMODEL
27 #define FMODEL
28 
29 #ifndef NLMODEL
31 #endif
32 
33 #include <gsl/gsl_multifit_nlin.h>
34 #include <gsl/gsl_deriv.h>
35 #include <gsl/gsl_math.h>
37 
38 //#include <list>
39 
40 namespace BALL
41 {
42  namespace QSAR
43  {
45  {
46  public:
50  FitModel(const QSARData& q);
51 
52  FitModel(const QSARData& q, vector<String>& eq, vector<double>& guess);
53 
54  FitModel(const QSARData& q, vector<String>& eq, vector<vector<String> >& deq, vector<double>& guess);
55 
56  //~FitModel();
58 
59 
66  void setEquations(vector<String>& eq, vector<vector<String> >& deq);
67 
69  void setEquations(vector<String>& eq);
70 
72  void train();
73 
74  Vector<double> predict(const vector<double>& substance, bool transform=1);
75 
76  void setInitialGuess(vector<double>& d);
78 
79 
80  private:
85  vector<String> allEquations_;
86 
88  vector<vector<String> > allDiffEquations_;
89 
91  //vector<String> allCoefficients;
92 
93  vector<double> initial_guess_;
95 
96  };
97 
98 
99 
103  vector<String>* diffEquations;
105  unsigned int c; // current column
106 
107  double getFunctionValue(double X, void* params);
108 
109  int setF(const gsl_vector* x, void* params, gsl_vector* f);
110 
111  int setDf(const gsl_vector * x, void* params, gsl_matrix * df);
112 
113  int setFdf (const gsl_vector * x, void *params, gsl_vector * f, gsl_matrix * df);
114 
115  gsl_multifit_function_fdf make_fdf (int (* f) (const gsl_vector *, void *, gsl_vector *),
116  int (* df) (const gsl_vector *, void *, gsl_matrix *),
117  int (* fdf) (const gsl_vector *, void *, gsl_vector *, gsl_matrix *),
118  size_t n,
119  size_t p, void * params );
120 
121  }
122 }
123 
124 #endif // FMODEL