Loading...
Searching...
No Matches
BALL::QSAR::ClassificationModel Class Reference

`#include <BALL/QSAR/classificationModel.h>`

Inheritance diagram for BALL::QSAR::ClassificationModel:

## Public Member Functions

Constructors and Destructors
| ClassificationModel (const QSARData &q)
| ~ClassificationModel ()
virtual void | operator= (ClassificationModel &m)
Public Member Functions inherited from BALL::QSAR::Model
| Model (const QSARData &q)
virtual | ~Model ()
virtual void | operator= (const Model &m)
void | copyData (const Model &m)
void | copyDescriptorIDs (const Model &m)
void | readTrainingData ()
virtual Eigen::VectorXd | predict (const vector< double > &substance, bool transform)=0
void | deleteDescriptorIDs ()
virtual void | train ()=0
virtual bool | optimizeParameters (int, int)
bool | optimizeParameters (int k)
virtual double | calculateStdErr ()
virtual void | setParameters (vector< double > &)
virtual vector< double > | getParameters () const
std::multiset< unsigned int > * | getDescriptorIDs ()
void | setDataSource (const QSARData *q)
virtual void | saveToFile (string filename)=0
virtual void | readFromFile (string filename)=0
const Eigen::MatrixXd * | getDescriptorMatrix ()
const vector< string > * | getSubstanceNames ()
const vector< string > * | getDescriptorNames ()
const Eigen::MatrixXd | getDescriptorTransformations ()
const Eigen::MatrixXd | getYTransformations ()
const Eigen::MatrixXd * | getY ()
void | setDescriptorIDs (const std::multiset< unsigned int > &sl)
const string * | getType ()
void | getUnnormalizedFeatureValue (int compound, int feature, double &return_value)
void | getUnnormalizedResponseValue (int compound, int response, double &return_value)

## Protected Member Functions

Input and Output. The following methods can be used to implement the functions saveToFile() and readFromFile() in final classes derived from this base-class
void | readClassInformationFromFile (std::ifstream &input, int no_classes)
void | saveClassInformationToFile (std::ofstream &out)
Protected Member Functions inherited from BALL::QSAR::Model
void | readMatrix (Eigen::MatrixXd &mat, std::ifstream &in, unsigned int lines, unsigned int col)
void | readVector (Eigen::RowVectorXd &vec, std::ifstream &in, unsigned int no_cells, bool column_vector)
void | readModelParametersFromFile (std::ifstream &in)
void | saveModelParametersToFile (std::ofstream &out)
virtual void | saveDescriptorInformationToFile (std::ofstream &out)
virtual void | readDescriptorInformationFromFile (std::ifstream &in, int no_descriptors, bool transformation)
void | readResponseTransformationFromFile (std::ifstream &in, int no_y)
void | saveResponseTransformationToFile (std::ofstream &out)
Eigen::VectorXd | getSubstanceVector (const vector< double > &substance, bool transform)
Eigen::VectorXd | getSubstanceVector (const Eigen::VectorXd &substance, bool transform)
void | backTransformPrediction (Eigen::VectorXd &pred)
void | addLambda (Eigen::MatrixXd &matrix, double &lambda)
void | readDescriptorInformation ()

## Attributes

ClassificationValidation * | validation
std::vector< int > | labels_
class | ClassificationValidation
std::vector< int > | getClassLabels ()

## Accessors

std::vector< int > | no_substances_
void | readLabels ()

## Feature discretization function

void(ClassificationModel::* | discretizeFeatures )(unsigned int bins, Eigen::MatrixXd &discretization_information)
void(ClassificationModel::* | discretizeTestDataFeatures )(Eigen::VectorXd &compound, unsigned int bins, const Eigen::MatrixXd &discretization_information)
void | equalSpaceDiscretization (unsigned int bins, Eigen::MatrixXd &discretization_information)
void | equalSpaceDiscretizationTestData (Eigen::VectorXd &compound, unsigned int bins, const Eigen::MatrixXd &discretization_information)

## Additional Inherited Members

const QSARData * | data
Validation * | model_val
int | default_no_opt_steps_
Eigen::MatrixXd | descriptor_matrix_
vector< string > | substance_names_
vector< string > | descriptor_names_
Eigen::MatrixXd | descriptor_transformations_
Eigen::MatrixXd | y_transformations_
Eigen::MatrixXd | Y_
String | type_
std::multiset< unsigned int > | descriptor_IDs_

## Detailed Description

Definition at line 26 of file classificationModel.h.

## Constructor & Destructor Documentation

## ClassificationModel()

BALL::QSAR::ClassificationModel::ClassificationModel | ( | const QSARData & | q | ) |

constructur,

Parameters

  q | QSAR-wrapper object, from which the data for this model should be taken

## ~ClassificationModel()

BALL::QSAR::ClassificationModel::~ClassificationModel | ( |  | ) |

## Member Function Documentation

## equalSpaceDiscretization()

void BALL::QSAR::ClassificationModel::equalSpaceDiscretization | ( | unsigned int | bins,
|  | Eigen::MatrixXd & | discretization_information )

protected

discretizes each feature in such a way that each created bin has an equal range of values

## equalSpaceDiscretizationTestData()

void BALL::QSAR::ClassificationModel::equalSpaceDiscretizationTestData | ( | Eigen::VectorXd & | compound,
|  | unsigned int | bins,
|  | const Eigen::MatrixXd & | discretization_information )

protected

## getClassLabels()

std::vector< int > BALL::QSAR::ClassificationModel::getClassLabels | ( |  | ) |

## operator=()

virtual void BALL::QSAR::ClassificationModel::operator= | ( | ClassificationModel & | m | ) |

virtual

## readClassInformationFromFile()

void BALL::QSAR::ClassificationModel::readClassInformationFromFile | ( | std::ifstream & | input,
|  | int | no_classes )

protected

## readLabels()

void BALL::QSAR::ClassificationModel::readLabels | ( |  | ) |

protected

read all different class labels from matrix Y into ClassificationModel.labels

## saveClassInformationToFile()

void BALL::QSAR::ClassificationModel::saveClassInformationToFile | ( | std::ofstream & | out | ) |

protected

## Friends And Related Symbol Documentation

## ClassificationValidation

friend class ClassificationValidation

friend

Definition at line 105 of file classificationModel.h.

## Member Data Documentation

## discretizeFeatures

void(ClassificationModel::* BALL::QSAR::ClassificationModel::discretizeFeatures) (unsigned int bins, Eigen::MatrixXd &discretization_information)

protected

Interface function-definition for discretization of features.
Thus, various functions that do the actual discretization can be created as members of ClassificationModel, allowing switching of the discretization technique by only (re-)setting this function-pointer.

Parameters

  bins | the number of discrete values to be created for each features
  discretization_information | a Eigen::MatrixXd into which the information about the applied discretization should be saved (into one column per feature). This Eigen::MatrixXd can later be used to discretize test data according to the discretization of the training data.

Definition at line 82 of file classificationModel.h.

## discretizeTestDataFeatures

void(ClassificationModel::* BALL::QSAR::ClassificationModel::discretizeTestDataFeatures) (Eigen::VectorXd &compound, unsigned int bins, const Eigen::MatrixXd &discretization_information)

protected

Discretizes test data according to the given discretization of the training data.

Parameters

  discretization_information | the discretization according to which the current descriptor_matrix should be discretized.

Definition at line 86 of file classificationModel.h.

## labels_

std::vector<int> BALL::QSAR::ClassificationModel::labels_

protected

labels for the different classes

Definition at line 102 of file classificationModel.h.

## no_substances_

std::vector<int> BALL::QSAR::ClassificationModel::no_substances_

protected

the number of substances in each class of the training data

Definition at line 62 of file classificationModel.h.

## validation

ClassificationValidation* BALL::QSAR::ClassificationModel::validation

a ClassificationValidation object, that is used to validate this model and that will contain the results of the validations

Definition at line 47 of file classificationModel.h.