BALL
1.4.1
|
00001 /* validation.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 VALIDATION 00027 #define VALIDATION 00028 00029 #ifndef QSARDATA 00030 #include <BALL/QSAR/QSARData.h> 00031 #endif 00032 00033 #include <gsl/gsl_randist.h> 00034 #include <gsl/gsl_cdf.h> 00035 #include <iterator> 00036 00037 00038 namespace BALL 00039 { 00040 namespace QSAR 00041 { 00042 class Model; 00043 00045 class BALL_EXPORT Validation 00046 { 00047 public: 00051 Validation(Model* m); 00052 00053 virtual ~Validation(); 00055 00056 00063 virtual void crossValidation(int k, bool restore=1) = 0; 00064 00066 virtual double getCVRes() = 0; 00067 00069 virtual double getFitRes() = 0; 00070 00072 virtual void setCVRes(double d) = 0; 00073 00076 const Matrix<double>& getYRandResults() const; 00077 00081 virtual void testInputData(bool transform=0) = 0; 00082 00083 virtual void bootstrap(int k, bool restore=1) = 0; 00084 00085 virtual const Matrix<double>& yRandomizationTest(int runs, int k) = 0; 00086 00090 virtual void selectStat(int s) = 0; 00091 00093 int getStat() const; 00094 00096 virtual void saveToFile(string filename) const = 0; 00097 00099 virtual void readFromFile(string filename) = 0; 00101 00102 00103 protected: 00104 00109 void setTrainingLine(int train_line, int current_line); 00110 00113 void setTestLine(int test_line, int current_line, bool back_transform=0); 00114 00116 void yRand(); 00118 00119 00124 vector<vector<double> > test_substances_; 00125 00127 Matrix<double> test_Y_; 00128 00130 vector<string> substances_names_; 00131 00132 00134 Model* model_; 00135 00137 int validation_statistic_; 00138 00139 Matrix<double> yRand_results_; 00141 00142 }; 00143 } 00144 } 00145 00146 00147 00148 #endif // VALIDATION