BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QSAR/kernel.h
Go to the documentation of this file.
1 /* kernel.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 KERNEL
27 #define KERNEL
28 
29 #ifndef LMODEL
30 #include <BALL/QSAR/linearModel.h>
31 #endif
32 
33 #ifndef MODEL
34 #include <BALL/QSAR/Model.h>
35 #endif
36 
37 #ifndef QSAR_EXCEPTION
38 #include <BALL/QSAR/exception.h>
39 #endif
40 
41 #ifndef REGRESSION
43 #endif
44 
45 #include <cmath>
46 #include <sstream>
47 
48 
49 namespace BALL
50 {
51  namespace QSAR
52  {
54  {
55 
56 
57  public:
61  Kernel(Model* m, int k_type, double p1, double p2=-1);
62 
63  Kernel(Model* m, String f, String g);
64 
65  Kernel(Model* m, Vector<double>& w);
66 
69  Kernel(Model* m, const LinearModel& lm, int column);
70 
71  ~Kernel();
73 
74 
82  void calculateKernelMatrix(Matrix<double>& input, Matrix<double>& output);
83 
88  void calculateKernelMatrix(Matrix<double>& K, Matrix<double>& m1, Matrix<double>& m2, Matrix<double>& output);
89 
90 
92  void calculateKernelVector(Matrix<double>& K,Vector<double>& m1, Matrix<double>& m2, Vector<double>& output);
93 
100  void gridSearch(double step_width, int steps, int recursions, int k, bool opt=0);
102 
103 
113  int type;
114 
116  double par1, par2;
117 
122 
128 
129 
130  protected:
134 
135  void gridSearch(double step_width, int steps, bool first_rec, int k, double par1_start, double par2_start, bool opt);
136 
139  void calculateWeightedKernelMatrix(Matrix<double>& input, Matrix<double>& output);
140 
141 
144  void calculateWeightedKernelMatrix(Matrix<double>& m1, Matrix<double>& m2, Matrix<double>& output);
145 
146 
147  void calculateKernelMatrix1(Matrix<double>& input, Matrix<double>& output);
148 
149  void calculateKernelMatrix2(Matrix<double>& input, Matrix<double>& output);
150 
151  void calculateKernelMatrix3(Matrix<double>& input, Matrix<double>& output);
152 
153  void calculateKernelMatrix4(Matrix<double>& input, Matrix<double>& output);
154 
155 
156  void calculateKernelMatrix1(Matrix<double>& m1, Matrix<double>& m2, Matrix<double>& output);
157 
158  void calculateKernelMatrix2(Matrix<double>& m1, Matrix<double>& m2, Matrix<double>& output);
159 
160  void calculateKernelMatrix3(Matrix<double>& m1, Matrix<double>& m2, Matrix<double>& output);
161 
162  void calculateKernelMatrix4(Matrix<double>& m1, Matrix<double>& m2, Matrix<double>& output);
164 
165 
171 
174 
175 
176  friend class FeatureSelection;
177 
178  };
179  }
180 }
181 
182 #endif // KERNEL