BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Friends | List of all members
BALL::QSAR::ClassificationModel Class Reference

#include <BALL/QSAR/classificationModel.h>

Inheritance diagram for BALL::QSAR::ClassificationModel:
BALL::QSAR::Model BALL::QSAR::BayesModel BALL::QSAR::LDAModel BALL::QSAR::LogitModel BALL::QSAR::SVMModel BALL::QSAR::NBModel BALL::QSAR::SNBModel

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 Vector< doublepredict (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< doublegetParameters () const
std::multiset< unsigned int > * getDescriptorIDs ()
void setDataSource (const QSARData *q)
virtual void saveToFile (string filename)=0
virtual void readFromFile (string filename)=0
const Matrix< double > * getDescriptorMatrix ()
const vector< string > * getSubstanceNames ()
const vector< string > * getDescriptorNames ()
const Matrix< double > * 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 (Matrix< double > &mat, std::ifstream &in, uint lines, uint col)
void readVector (Vector< double > &vec, std::ifstream &in, uint 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)
Vector< doublegetSubstanceVector (const vector< double > &substance, bool transform)
Vector< doublegetSubstanceVector (const Vector< double > &substance, bool transform)
void backTransformPrediction (Vector< double > &pred)
void addLambda (Matrix< double > &matrix, double &lambda)
void readDescriptorInformation ()

Friends

class ClassificationValidation

Attributes

ClassificationValidationvalidation
std::vector< int > labels_
std::vector< int > getClassLabels ()

Accessors

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

Feature discretization function

void(ClassificationModel::* discretizeFeatures )(uint bins, BALL::Matrix< double > &discretization_information)
void(ClassificationModel::* discretizeTestDataFeatures )(Vector< double > &compound, uint bins, const BALL::Matrix< double > &discretization_information)
void equalSpaceDiscretization (uint bins, BALL::Matrix< double > &discretization_information)
void equalSpaceDiscretizationTestData (Vector< double > &compound, uint bins, const BALL::Matrix< double > &discretization_information)

Additional Inherited Members

- Public Attributes inherited from BALL::QSAR::Model
const QSARDatadata
Validationmodel_val
- Protected Attributes inherited from BALL::QSAR::Model
int default_no_opt_steps_
Matrix< doubledescriptor_matrix_
vector< string > substance_names_
vector< string > descriptor_names_
Matrix< doubledescriptor_transformations_
Matrix< doubley_transformations_
Matrix< doubleY_
String type_
std::multiset< unsigned int > descriptor_IDs_

Detailed Description

Definition at line 46 of file classificationModel.h.

Constructor & Destructor Documentation

BALL::QSAR::ClassificationModel::ClassificationModel ( const QSARData q)
constructur,
Parameters
qQSAR-wrapper object, from which the data for this model should be taken
BALL::QSAR::ClassificationModel::~ClassificationModel ( )

Member Function Documentation

void BALL::QSAR::ClassificationModel::equalSpaceDiscretization ( uint  bins,
BALL::Matrix< double > &  discretization_information 
)
protected

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

void BALL::QSAR::ClassificationModel::equalSpaceDiscretizationTestData ( Vector< double > &  compound,
uint  bins,
const BALL::Matrix< double > &  discretization_information 
)
protected
std::vector<int> BALL::QSAR::ClassificationModel::getClassLabels ( )
virtual void BALL::QSAR::ClassificationModel::operator= ( ClassificationModel m)
virtual
void BALL::QSAR::ClassificationModel::readClassInformationFromFile ( std::ifstream &  input,
int  no_classes 
)
protected
void BALL::QSAR::ClassificationModel::readLabels ( )
protected

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

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

Friends And Related Function Documentation

friend class ClassificationValidation
friend

Definition at line 126 of file classificationModel.h.

Member Data Documentation

void(ClassificationModel::* BALL::QSAR::ClassificationModel::discretizeFeatures)(uint bins, BALL::Matrix< double > &discretization_information)
protected
Interface function-definition for discretization of features.\n

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
binsthe number of discrete values to be created for each features
discretization_informationa BALL::Matrix<double> into which the information about the applied discretization should be saved (into one column per feature).
This BALL::Matrix<double> can later be used to discretize test data according to the discretization of the training data.

Definition at line 101 of file classificationModel.h.

void(ClassificationModel::* BALL::QSAR::ClassificationModel::discretizeTestDataFeatures)(Vector< double > &compound, uint bins, const BALL::Matrix< double > &discretization_information)
protected
Discretizes test data according to the given discretization of the training data.
Parameters
discretization_informationthe discretization according to which the current descriptor_matrix should be discretized.

Definition at line 105 of file classificationModel.h.

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

labels for the different classes

Definition at line 123 of file classificationModel.h.

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

the number of substances in each class of the training data

Definition at line 81 of file classificationModel.h.

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 66 of file classificationModel.h.