BALL  1.4.1
kernelModel.h
Go to the documentation of this file.
00001 /* kernelModel.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 KMODEL
00027 #define KMODEL
00028 
00029 #ifndef NLMODEL
00030 #include <BALL/QSAR/nonlinearModel.h>
00031 #endif
00032 
00033 #ifndef LMODEL
00034 #include <BALL/QSAR/linearModel.h>
00035 #endif
00036 
00037 #ifndef KERNEL
00038 #include <BALL/QSAR/kernel.h>
00039 #endif
00040 
00041 
00042 
00043 namespace BALL
00044 {
00045   namespace QSAR
00046   {
00047     class BALL_EXPORT KernelModel : public NonLinearModel
00048     {
00049       public:
00053         KernelModel(const QSARData& q, int k_type, double p1, double p2);
00054         
00055         KernelModel(const QSARData& q, String f, String g);
00056             
00057         KernelModel(const QSARData& q, Vector<double>& w);
00058         
00059         KernelModel(const QSARData& q, const LinearModel& lm, int column);
00060         
00061         ~KernelModel();
00062         
00063         virtual void saveToFile(string filename);
00064         
00065         virtual void readFromFile(string filename);
00066         
00067         virtual Vector<double> predict(const vector<double>& substance, bool transform);
00068         
00069         void operator=(const Model& m);
00071         
00075         Kernel* kernel;
00077 
00078         
00079       protected:
00080         
00085         Matrix<double> K_;
00086         
00088         //Matrix B;
00090         
00091         
00095         void calculateOffsets();
00096         
00097         void readKernelParametersFromFile(std::ifstream& in);
00098         void saveKernelParametersToFile(std::ofstream& out);
00099         void saveTrainingResult(std::ofstream& out);
00100         void readTrainingResult(std::ifstream& input, int no_substances, int no_y);
00101         
00102         friend class RegressionValidation;
00103         //}@
00104         
00105       
00106     };
00107   }
00108 }
00109 
00110 
00111 #endif // NLMODEL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines