BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
classificationValidation.h
Go to the documentation of this file.
1 /* classificationValidation.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 CLASVALIDATION
27 #define CLASVALIDATION
28 
29 #ifndef QSARDATA
30 #include <BALL/QSAR/QSARData.h>
31 #endif
32 
33 #ifndef VALIDATION
34 #include <BALL/QSAR/validation.h>
35 #endif
36 
37 #include <gsl/gsl_randist.h>
38 #include <gsl/gsl_cdf.h>
39 #include <iterator>
40 
41 
42 namespace BALL
43 {
44  namespace QSAR
45  {
46  class ClassificationModel;
49  {
50  public:
58 
59 
63  void crossValidation(int k, bool restore=1);
64 
65  double getCVRes();
66 
67  double getFitRes();
68 
69  void setCVRes(double d);
70 
71  void testInputData(bool transform=0);
72 
74  const BALL::Matrix<double>* getConfusionMatrix();
75 
77  const BALL::Vector<double>* getClassResults();
78 
81  void bootstrap(int k, bool restore=1);
82 
86  const BALL::Matrix<double>& yRandomizationTest(int runs, int k);
87 
89  double getAccuracyCV();
90 
92  double getAccuracyInputTest();
93 
94  void selectStat(int s);
95 
96  void saveToFile(string filename) const;
97 
98  void saveToFile(string filename, const double& quality_input_test, const double& predictive_quality) const;
99 
100  void readFromFile(string filename);
101 
103 
104 
105  private:
110  void testAllSubstances(bool transform);
111 
113  void calculateAverageSensitivity();
114 
116  void calculateWeightedSensitivity();
117 
119  void calculateOverallAccuracy();
120 
122  void calculateAverageMCC();
123 
125  void calculateOverallMCC();
126 
128  void calculateTDR();
130 
131 
137 
140 
141  double quality_;
142 
144 
145  double quality_cv_;
146 
149 
150  void (ClassificationValidation::* qualCalculation)();
151 
152 
154 
155  };
156  }
157 }
158 
159 
160 
161 #endif // REGVALIDATION