BALL  1.4.1
snBModel.h
Go to the documentation of this file.
00001 /* snBModel.h
00002  * 
00003  * Copyright (C) 2009 Marcel Schumann
00004  * 
00005  * This file is part of QuEasy -- A Toolbox for Automated QSAR Model
00006  * Construction and Validation.
00007  * QuEasy is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3 of the License, or (at
00010  * your option) any later version.
00011  * 
00012  * QuEasy is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 // -*- Mode: C++; tab-width: 2; -*-
00022 // vi: set ts=2:
00023 //
00024 //
00025 
00026 #ifndef SNBMODEL
00027 #define SNBMODEL
00028 
00029 #ifndef STATISTICS
00030 #include <BALL/QSAR/statistics.h>
00031 #endif
00032 
00033 #ifndef BAYESMODEL
00034 #include <BALL/QSAR/bayesModel.h>
00035 #endif
00036 
00037 
00038 namespace BALL{
00039   namespace QSAR {
00040 
00042     class BALL_EXPORT SNBModel : public BayesModel
00043     { 
00044       public:
00048         SNBModel(const QSARData& q);
00049 
00050         ~SNBModel();
00052         
00053         
00057         void train();
00058         
00059         Vector<double> predict(const vector<double>& substance, bool transform=1);
00060         
00061         vector<double> getParameters() const;
00062         
00063         void setParameters(vector<double>& v);
00064         
00065         void saveToFile(string filename);
00066         
00067         bool isTrained();
00068         
00069         void readFromFile(string filename);
00070         
00073         vector<double> calculateProbabilities(int activitiy_index, int feature_index, double feature_value);
00074         
00075         int getNoResponseVariables();
00077         
00078         
00079       private:
00084         vector<Matrix<double> > mean_;
00085         
00087         vector<Matrix<double> > stddev_;
00088         
00089         static const double sqrt2Pi_;
00090               
00091 
00092         
00094     };
00095   }
00096 }
00097 
00098 #endif //SNBMODEL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines