#include <BALL/QSAR/regressionValidation.h>
|
void | crossValidation (int k, bool restore=1) |
|
void | crossValidation (int k, vector< BALL::Matrix< double > > *results, bool restore=1) |
|
void | bootstrap (int k, bool restore=1) |
|
void | bootstrap (int k, vector< BALL::Matrix< double > > *results, bool restore=1) |
|
void | bootstrap1 (int k, vector< BALL::Matrix< double > > *results, bool restore=1) |
|
const BALL::Matrix< double > & | yRandomizationTest (int runs, int k) |
|
double | getQ2 () |
|
double | getR2 () |
|
double | getFregr () |
|
double | getFcv () |
|
double | getCVRes () |
|
double | getFitRes () |
|
double | getMaxError () |
|
void | setCVRes (double d) |
|
void | setQ2 (double d) |
|
void | testInputData (bool transform=0) |
|
void | selectStat (int s) |
|
void | calculateCoefficientStdErrors (int k, bool b=1) |
|
const BALL::Matrix< double > * | getCoefficientStdErrors () |
|
void | setCoefficientStdErrors (const BALL::Matrix< double > *stddev) |
|
void | saveToFile (string filename) const |
|
void | saveToFile (string filename, const double &r2, const double &q2, const Matrix< double > &coefficient_stddev, const Matrix< double > &yRand_results) const |
|
void | readFromFile (string filename) |
|
void | testAllSubstances (bool transform) |
|
void | backupTrainingResults () |
|
void | restoreTrainingResults () |
|
class for validation of QSAR regression models
Definition at line 53 of file regressionValidation.h.
BALL::QSAR::RegressionValidation::RegressionValidation |
( |
RegressionModel * |
m | ) |
|
constructor
- Parameters
-
m | pointer to the regression model, which the object of this class should test |
BALL::QSAR::RegressionValidation::~RegressionValidation |
( |
| ) |
|
void BALL::QSAR::RegressionValidation::backupTrainingResults |
( |
| ) |
|
|
private |
void BALL::QSAR::RegressionValidation::bootstrap |
( |
int |
k, |
|
|
bool |
restore = 1 |
|
) |
| |
|
virtual |
starts bootstrapping with k samples \n
- Parameters
-
k | no of bootstrap samples |
restore | if restore==1, Model.descriptor_matrix and RegressionModel.training_result is restored after bootstrapping |
Implements BALL::QSAR::Validation.
void BALL::QSAR::RegressionValidation::bootstrap |
( |
int |
k, |
|
|
vector< BALL::Matrix< double > > * |
results, |
|
|
bool |
restore = 1 |
|
) |
| |
starts bootstrapping with k samples \n
- Parameters
-
k | no of bootstrap samples |
restore | if restore==1, Model.descriptor_matrix and RegressionModel.training_result is restored after bootstrapping |
results | pointer to vector that should take all matrices RegressionModel.training_result produced during this bootstrapping |
void BALL::QSAR::RegressionValidation::bootstrap1 |
( |
int |
k, |
|
|
vector< BALL::Matrix< double > > * |
results, |
|
|
bool |
restore = 1 |
|
) |
| |
void BALL::QSAR::RegressionValidation::calculateCoefficientStdErrors |
( |
int |
k, |
|
|
bool |
b = 1 |
|
) |
| |
calculates standart deviations for all predicted coefficients and saves them to coefficient_stddev_ \n
- Parameters
-
b | if b==1, bootstrapping is used; else: cross-validation |
k | number of bootstrap samples resp. cross-validation steps |
void BALL::QSAR::RegressionValidation::calculateQOF |
( |
| ) |
|
|
private |
void BALL::QSAR::RegressionValidation::crossValidation |
( |
int |
k, |
|
|
bool |
restore = 1 |
|
) |
| |
|
virtual |
starts k-fold cross validation \n
- Parameters
-
k | no of cross validation folds |
restore | if restore==1, Model.descriptor_matrix and RegressionModel.training_result is restored after cross validation |
Implements BALL::QSAR::Validation.
void BALL::QSAR::RegressionValidation::crossValidation |
( |
int |
k, |
|
|
vector< BALL::Matrix< double > > * |
results, |
|
|
bool |
restore = 1 |
|
) |
| |
starts k-fold cross validation \n
- Parameters
-
k | no of cross validation folds |
restore | if restore==1, Model.descriptor_matrix and RegressionModel.training_result is restored after cross validation |
results | pointer to vector that should take all matrices RegressionModel.training_result produced during this cross validation run |
returns a const pointer to the matrix containing the standart deviations of all predicted coefficients
double BALL::QSAR::RegressionValidation::getCVRes |
( |
| ) |
|
|
virtual |
double BALL::QSAR::RegressionValidation::getFcv |
( |
| ) |
|
get the F-value as calculated by cross validation.\n
If crossValidation() has not been run yet, -1 is returned
double BALL::QSAR::RegressionValidation::getFitRes |
( |
| ) |
|
|
virtual |
double BALL::QSAR::RegressionValidation::getFregr |
( |
| ) |
|
get the F-value as calculated by testInputData().\n
If testInputData() has not been run yet, -1 is returned
double BALL::QSAR::RegressionValidation::getMaxError |
( |
| ) |
|
returns the maximal error of the prediction
double BALL::QSAR::RegressionValidation::getQ2 |
( |
| ) |
|
get the Q^2 value.\n
If no cross-validation has been done yet, -1 is returned
double BALL::QSAR::RegressionValidation::getR2 |
( |
| ) |
|
get the R^2 value.\n
If testInputData() has not been run yet, -1 is returned
void BALL::QSAR::RegressionValidation::readFromFile |
( |
string |
filename | ) |
|
|
virtual |
void BALL::QSAR::RegressionValidation::restoreTrainingResults |
( |
| ) |
|
|
private |
void BALL::QSAR::RegressionValidation::saveToFile |
( |
string |
filename | ) |
const |
|
virtual |
void BALL::QSAR::RegressionValidation::saveToFile |
( |
string |
filename, |
|
|
const double & |
r2, |
|
|
const double & |
q2, |
|
|
const Matrix< double > & |
coefficient_stddev, |
|
|
const Matrix< double > & |
yRand_results |
|
) |
| const |
void BALL::QSAR::RegressionValidation::selectStat |
( |
int |
s | ) |
|
|
virtual |
select the desired statistic to be used for validating the models
- Parameters
-
s | if (s==1) R^2 and Q^2 are used
if(s==2) F_regr and F_cv are used. |
Implements BALL::QSAR::Validation.
void BALL::QSAR::RegressionValidation::setCoefficientStdErrors |
( |
const BALL::Matrix< double > * |
stddev | ) |
|
void BALL::QSAR::RegressionValidation::setCVRes |
( |
double |
d | ) |
|
|
virtual |
void BALL::QSAR::RegressionValidation::setQ2 |
( |
double |
d | ) |
|
void BALL::QSAR::RegressionValidation::testAllSubstances |
( |
bool |
transform | ) |
|
|
private |
Tests the current model with all substances in the (unchanged) test data set
void BALL::QSAR::RegressionValidation::testInputData |
( |
bool |
transform = 0 | ) |
|
|
virtual |
Fetches input data from QSARData and tests the current (unchanged) model with all these new substances (without cross-validation!). \n
- Parameters
-
transform | if transform==1, the test data is transformed in the same way that the training data was transformed before predicting activities.
If training and test substances are taken from the same input file, set transform to 0 |
Implements BALL::QSAR::Validation.
const BALL::Matrix<double>& BALL::QSAR::RegressionValidation::yRandomizationTest |
( |
int |
runs, |
|
|
int |
k |
|
) |
| |
|
virtual |
Y randomization test \n
Randomizes all columns of model.Y, trains the model, runs crossValidation and testInputData and saves the resulting R2 and Q2 value to a matrix with 2 columns; the R2 values makeing up the first colum, the Q2 value the second.
- Parameters
-
runs | this is repeated as often as specified by 'runs' |
Implements BALL::QSAR::Validation.
BackupData BALL::QSAR::RegressionValidation::backup_data_ |
|
private |
contains the standart deviations of all predicted coefficients in one column for each modelled activity
Definition at line 216 of file regressionValidation.h.
double BALL::QSAR::RegressionValidation::F_cv_ |
|
private |
double BALL::QSAR::RegressionValidation::F_regr_ |
|
private |
double(RegressionValidation::* BALL::QSAR::RegressionValidation::fitQualFetcher_)() |
|
private |
double BALL::QSAR::RegressionValidation::max_error_ |
|
private |
double(RegressionValidation::* BALL::QSAR::RegressionValidation::predQualFetcher_)() |
|
private |
double BALL::QSAR::RegressionValidation::Q2_ |
|
private |
void(RegressionValidation::* BALL::QSAR::RegressionValidation::qualCalculation)() |
|
private |
double BALL::QSAR::RegressionValidation::quality_ |
|
private |
double BALL::QSAR::RegressionValidation::R2_ |
|
private |
pointer to the regression model, which the object of this class should test
Definition at line 219 of file regressionValidation.h.
double BALL::QSAR::RegressionValidation::ssE_ |
|
private |
double BALL::QSAR::RegressionValidation::ssR_ |
|
private |
double BALL::QSAR::RegressionValidation::ssY_ |
|
private |
double BALL::QSAR::RegressionValidation::std_err_ |
|
private |