BALL 1.5.0
Loading...
Searching...
No Matches
regressionValidation.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4//
5
6#ifndef BALL_QSAR_REGRESSIONVALIDATION_H
7#define BALL_QSAR_REGRESSIONVALIDATION_H
8
9#include <BALL/QSAR/common.h>
10
11#include <BALL/QSAR/QSARData.h>
12
14
15#include <iterator>
16
17namespace BALL
18{
19 namespace QSAR
20 {
21 class RegressionModel;
24 {
25 public:
32
34
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37
38
45 void crossValidation(int k, bool restore=true);
46
51 void crossValidation(int k, MatrixVector* results, bool restore=true);
52
53
57 void bootstrap(int k, bool restore=1);
58
63 void bootstrap(int k, MatrixVector* results, bool restore=true);
64
65 void bootstrap1(int k, MatrixVector* results, bool restore=true);
66
70 const Eigen::MatrixXd& yRandomizationTest(int runs, int k);
71
74 double getQ2();
75
78 double getR2();
79
82 double getFregr();
83
86 double getFcv();
87
88 double getCVRes();
89
90 double getFitRes();
91
93 double getMaxError();
94
95 void setCVRes(double d);
96
98 void setQ2(double d);
99
100 void testInputData(bool transform=0);
101
105 void selectStat(int s);
106
110 void calculateCoefficientStdErrors(int k, bool b=1);
111
113 const Eigen::MatrixXd* getCoefficientStdErrors();
114
115 void setCoefficientStdErrors(const Eigen::MatrixXd* stddev);
116
117 void saveToFile(string filename) const;
118
119 void saveToFile(string filename, const double& r2, const double& q2, const Eigen::MatrixXd& coefficient_stddev, const Eigen::MatrixXd& yRand_results) const;
120
121 void readFromFile(string filename);
123
124
125 private:
126
127 struct BackupData
128 {
129 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
130
131 Eigen::MatrixXd descriptor_matrix;
132 Eigen::MatrixXd training_result;
133 Eigen::MatrixXd Y;
134 Eigen::MatrixXd K;
135 Eigen::MatrixXd latent_variables;
136 Eigen::MatrixXd loadings;
137 Eigen::MatrixXd weights;
138 };
139
140
145 void testAllSubstances(bool transform);
146
147 void backupTrainingResults();
148
149 void restoreTrainingResults();
151
152
156
157 double ssR_;
158
159 double ssE_;
160
162 double ssY_;
163
165 double std_err_;
166
168 double Q2_;
169
171 double F_cv_;
172
174 double F_regr_;
175
176 double R2_;
177
178 double max_error_;
179
181 double quality_;
182
183 double (RegressionValidation::* predQualFetcher_)();
184
185 double (RegressionValidation::* fitQualFetcher_)();
186
187 void calculateQOF();
188
190 Eigen::MatrixXd coefficient_stderr_;
191
193 RegressionModel* regr_model_;
194
195 BackupData backup_data_;
196
197 void (RegressionValidation::* qualCalculation)();
199
200 };
201 }
202}
203
204
205
206#endif // BALL_QSAR_REGRESSIONVALIDATION_H
std::vector< Eigen::MatrixXd, Eigen::aligned_allocator< Eigen::MatrixXd > > MatrixVector
Definition QSAR/common.h:10
const Eigen::MatrixXd & yRandomizationTest(int runs, int k)
RegressionValidation(RegressionModel *m)
void crossValidation(int k, bool restore=true)
void saveToFile(string filename, const double &r2, const double &q2, const Eigen::MatrixXd &coefficient_stddev, const Eigen::MatrixXd &yRand_results) const
void crossValidation(int k, MatrixVector *results, bool restore=true)
void bootstrap1(int k, MatrixVector *results, bool restore=true)
void saveToFile(string filename) const
void setCoefficientStdErrors(const Eigen::MatrixXd *stddev)
void bootstrap(int k, bool restore=1)
const Eigen::MatrixXd * getCoefficientStdErrors()
void testInputData(bool transform=0)
void calculateCoefficientStdErrors(int k, bool b=1)
void readFromFile(string filename)
void bootstrap(int k, MatrixVector *results, bool restore=true)
#define BALL_EXPORT