5 #ifndef BALL_QSAR_MODEL_H
6 #define BALL_QSAR_MODEL_H
9 #ifndef BALL_QSAR_VALIDATION_H
13 #ifndef BALL_QSAR_QSARDATA_H
17 #ifndef BALL_QSAR_EXCEPTION_H
21 #ifndef BALL_MATHS_PARSEDFUNCTION_H
48 virtual void operator=(
const Model& m);
50 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
58 void copyData(
const Model& m);
61 void copyDescriptorIDs(
const Model& m);
67 void readTrainingData();
76 virtual Eigen::VectorXd predict(
const vector<double>& substance,
bool transform) =0;
79 void deleteDescriptorIDs();
82 virtual void train() =0;
91 bool optimizeParameters(
int k);
99 virtual vector<double> getParameters()
const;
102 std::multiset<unsigned int>* getDescriptorIDs();
104 void setDataSource(
const QSARData* q);
107 virtual void saveToFile(
string filename) = 0;
110 virtual void readFromFile(
string filename) = 0;
113 const Eigen::MatrixXd* getDescriptorMatrix();
116 const vector<string>* getSubstanceNames();
119 const vector<string>* getDescriptorNames();
122 const Eigen::MatrixXd getDescriptorTransformations();
124 const Eigen::MatrixXd getYTransformations();
127 const Eigen::MatrixXd* getY();
130 void setDescriptorIDs(
const std::multiset<unsigned int>& sl);
133 const string* getType();
136 void getUnnormalizedFeatureValue(
int compound,
int feature,
double& return_value);
139 void getUnnormalizedResponseValue(
int compound,
int response,
double& return_value);
166 Eigen::VectorXd getSubstanceVector(
const vector<double>& substance,
bool transform);
168 Eigen::VectorXd getSubstanceVector(
const Eigen::VectorXd& substance,
bool transform);
171 void backTransformPrediction(Eigen::VectorXd& pred);
174 void addLambda(Eigen::MatrixXd& matrix,
double& lambda);
177 void readDescriptorInformation();
185 void readMatrix(Eigen::MatrixXd& mat, std::ifstream& in,
unsigned int lines,
unsigned int col);
187 void readVector(Eigen::RowVectorXd& vec, std::ifstream& in,
unsigned int no_cells,
bool column_vector);
189 void readModelParametersFromFile(std::ifstream& in);
190 void saveModelParametersToFile(std::ofstream& out);
194 virtual void saveDescriptorInformationToFile(std::ofstream& out);
195 virtual void readDescriptorInformationFromFile(std::ifstream& in,
int no_descriptors,
bool transformation);
197 void readResponseTransformationFromFile(std::ifstream& in,
int no_y);
198 void saveResponseTransformationToFile(std::ofstream& out);
248 #endif // BALL_QSAR_MODEL_H
int default_no_opt_steps_
virtual void setParameters(vector< double > &)
virtual double calculateStdErr()
virtual bool optimizeParameters(int, int)
Eigen::MatrixXd descriptor_transformations_
BALL_EXTERN_VARIABLE const double k
vector< string > substance_names_
Eigen::MatrixXd y_transformations_
BALL_EXPORT Model * createNewModelFromFile(String model_file, const QSARData &q)
std::multiset< unsigned int > descriptor_IDs_
Eigen::MatrixXd descriptor_matrix_
vector< string > descriptor_names_