BALL  1.4.1
allModel.h
Go to the documentation of this file.
00001 /* allModel.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 ALLMODEL
00027 #define ALLMODEL
00028 
00029 #ifndef NLMODEL
00030 #include <BALL/QSAR/nonlinearModel.h>
00031 #endif
00032 
00033 
00034 namespace BALL
00035 {
00036   namespace QSAR 
00037   {
00038 
00040     class BALL_EXPORT ALLModel : public NonLinearModel
00041     { 
00042       public:
00046         ALLModel(const QSARData& q, double kw=4);
00047 
00048         ~ALLModel();
00050         
00054         void setKw(double kw);
00055         
00056         virtual Vector<double> predict(const vector<double>& substance, bool transform=1);
00057         
00059         void train(){};
00060         
00062         virtual bool optimizeParameters(int d, int no_steps);
00063         
00065         double getKw();
00066         
00067         virtual void setParameters(vector<double>& v);
00068         
00069         virtual vector<double> getParameters() const;
00070         
00071         void saveToFile(string filename);
00072         
00073         void readFromFile(string filename);
00075         
00076         
00077       protected:
00078         
00082         virtual void calculateWeights(BALL::Matrix<double>& dist, BALL::Vector<double>& w);
00083         
00085         void calculateXX(BALL::Vector<double>& w, BALL::Matrix<double>& res);
00086       
00088         void calculateXY(BALL::Vector<double>& w, BALL::Matrix<double>& res);
00089         
00091         void calculateEuclDistanceMatrix(BALL::Matrix<double>& m1, BALL::Matrix<double>& m2, BALL::Matrix<double>& output);
00093         
00094         
00099         double kw_;
00100         double lambda_;
00102     };
00103   }
00104 }
00105 
00106 #endif // ALLMODEL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines