BALL  1.4.79
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 <iterator>
38 
39 
40 namespace BALL
41 {
42  namespace QSAR
43  {
44  class ClassificationModel;
47  {
48  public:
55 
56  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
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 Eigen::MatrixXd* getConfusionMatrix();
75 
77  const Eigen::VectorXd* getClassResults();
78 
81  void bootstrap(int k, bool restore=1);
82 
86  const Eigen::MatrixXd& 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 
136  Eigen::MatrixXd confusion_matrix_;
137 
139  Eigen::VectorXd class_results_;
140 
141  double quality_;
142 
143  double quality_input_test_;
144 
145  double quality_cv_;
146 
148  ClassificationModel* clas_model;
149 
150  void (ClassificationValidation::* qualCalculation)();
151 
152 
154 
155  };
156  }
157 }
158 
159 
160 
161 #endif // REGVALIDATION
BALL_EXTERN_VARIABLE const double k
Definition: constants.h:93
-*- Mode: C++; tab-width: 2; -*-
Definition: constants.h:12
#define BALL_EXPORT
Definition: COMMON/global.h:50