BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
allModel.h
Go to the documentation of this file.
1 /* allModel.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 ALLMODEL
27 #define ALLMODEL
28 
29 #ifndef NLMODEL
31 #endif
32 
33 
34 namespace BALL
35 {
36  namespace QSAR
37  {
38 
41  {
42  public:
46  ALLModel(const QSARData& q, double kw=4);
47 
48  ~ALLModel();
50 
54  void setKw(double kw);
55 
56  virtual Vector<double> predict(const vector<double>& substance, bool transform=1);
57 
59  void train(){};
60 
62  virtual bool optimizeParameters(int d, int no_steps);
63 
65  double getKw();
66 
67  virtual void setParameters(vector<double>& v);
68 
69  virtual vector<double> getParameters() const;
70 
71  void saveToFile(string filename);
72 
73  void readFromFile(string filename);
75 
76 
77  protected:
78 
82  virtual void calculateWeights(BALL::Matrix<double>& dist, BALL::Vector<double>& w);
83 
85  void calculateXX(BALL::Vector<double>& w, BALL::Matrix<double>& res);
86 
88  void calculateXY(BALL::Vector<double>& w, BALL::Matrix<double>& res);
89 
91  void calculateEuclDistanceMatrix(BALL::Matrix<double>& m1, BALL::Matrix<double>& m2, BALL::Matrix<double>& output);
93 
94 
99  double kw_;
100  double lambda_;
102  };
103  }
104 }
105 
106 #endif // ALLMODEL