BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
snBModel.h
Go to the documentation of this file.
1 /* snBModel.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 SNBMODEL
27 #define SNBMODEL
28 
29 #ifndef STATISTICS
30 #include <BALL/QSAR/statistics.h>
31 #endif
32 
33 #ifndef BAYESMODEL
34 #include <BALL/QSAR/bayesModel.h>
35 #endif
36 
37 
38 namespace BALL{
39  namespace QSAR {
40 
43  {
44  public:
48  SNBModel(const QSARData& q);
49 
50  ~SNBModel();
52 
53 
57  void train();
58 
59  Vector<double> predict(const vector<double>& substance, bool transform=1);
60 
61  vector<double> getParameters() const;
62 
63  void setParameters(vector<double>& v);
64 
65  void saveToFile(string filename);
66 
67  bool isTrained();
68 
69  void readFromFile(string filename);
70 
73  vector<double> calculateProbabilities(int activitiy_index, int feature_index, double feature_value);
74 
75  int getNoResponseVariables();
77 
78 
79  private:
84  vector<Matrix<double> > mean_;
85 
87  vector<Matrix<double> > stddev_;
88 
89  static const double sqrt2Pi_;
90 
91 
92 
94  };
95  }
96 }
97 
98 #endif //SNBMODEL