BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
registry.h
Go to the documentation of this file.
1 /* registry.h
2  *
3  * Copyright (C) 2009 Marcel Schumann
4  *
5  * This file is part of QuEasy -- A Toolbox for Automated QSAR Model
6  * Construction and Validation.
7  * QuEasy is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or (at
10  * your option) any later version.
11  *
12  * QuEasy is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef BALL_QSAR_REGISTRY_H
22 #define BALL_QSAR_REGISTRY_H
23 
24 #ifndef MODEL_FACTORY_H
25 #include <BALL/QSAR/modelFactory.h>
26 #endif
27 
28 #include <map>
29 
30 #ifdef BALL_HAS_LIBSVM
31 # include <BALL/QSAR/libsvmModel.h>
32 #endif
33 
34 namespace BALL
35 {
36  namespace QSAR
37  {
38  class QSARData;
39 
40  typedef Model* (*CreateMethod) (const QSARData& q);
41  typedef Model* (*CreateKernel1) (const QSARData& q, int k, double p1, double p2);
42  typedef Model* (*CreateKernel2) (const QSARData& q, String s1, String s2);
43 
44  class Registry;
45 
47  {
48  public:
49 
54  RegistryEntry(bool k, bool r, String n, String ab, CreateMethod c0);
55 
60  RegistryEntry(bool k, bool r, String n, String ab, CreateKernel1 c1, CreateKernel2 c2);
61 
62  RegistryEntry(const RegistryEntry& entry);
63 
64  ~RegistryEntry();
65 
66  const std::map<unsigned int,String>* getStatistics();
67  String getStatName(int s);
68 
69  bool kernel;
70  bool regression; // regression or classification?!
71  bool latent_variables; // is this a latent variable model?!
72  std::multiset<int> optimizableParameters;
73  //bool optimizable;
74  String name; // name of the Model
79  vector<String> parameterNames;
80  vector<double> parameterDefaults;
81  Registry* getRegistry();
82 
83  private:
84  Registry* registry_;
85 
86  friend class Registry;
87  };
88 
89 
90  typedef std::map<int,RegistryEntry>::iterator RegistryEntryIterator;
91 
93  {
94  public:
95  Registry();
96 
97  ~Registry();
98 
101 
104 
107 
110 
113 
116 
119 
122 
125 
131 
132  void addEntry(RegistryEntry entry, int uniqueID);
133 
135  RegistryEntry* getEntry(String model_name);
136 
138  RegistryEntry* getEntry(int ID);
139 
141  int getModelNo(String model_name);
142 
143  String getClassificationStatisticName(unsigned int no);
144  String getRegressionStatisticName(unsigned int no);
145  String getFeatureSelectionName(unsigned int no);
146  String getValidationName(unsigned int no);
147  const std::map<unsigned int,String>* getClassificationStatistics();
148  const std::map<unsigned int,String>* getRegressionStatistics();
149 
151  RegistryEntryIterator beginEntry();
152 
154  RegistryEntryIterator endEntry();
155 
156 
157  private:
158  std::map<int,RegistryEntry> registered_models;
159 
161  std::map<String,int> model_map;
162 
163  std::map<unsigned int,String> classification_statistics;
164  std::map<unsigned int,String> regression_statistics;
165  std::map<unsigned int,String> feature_selection_names;
166  std::map<unsigned int,String> validation_names;
167 
168  friend class RegistryEntry;
169  };
170 
171 
172  }
173 }
174 
175 #endif // BALL_QSAR_REGISTRY_H
Model *(* CreateMethod)(const QSARData &q)
Definition: registry.h:40
double default_gridsearch_par1_start
Definition: registry.h:129
int default_gridsearch_recursion
Definition: registry.h:127
double default_kernel_par2
Definition: registry.h:103
double default_rbf_par
Definition: registry.h:106
Model *(* CreateKernel2)(const QSARData &q, String s1, String s2)
Definition: registry.h:42
CreateKernel1 createKernel1
Definition: registry.h:77
vector< String > parameterNames
Definition: registry.h:79
double default_kernel_par1
Definition: registry.h:100
int default_gridsearch_steps
Definition: registry.h:128
vector< double > parameterDefaults
Definition: registry.h:80
std::multiset< int > optimizableParameters
Definition: registry.h:72
BALL_EXTERN_VARIABLE const double k
Definition: constants.h:93
CreateMethod create
Definition: registry.h:76
double default_valdition_fraction
Definition: registry.h:118
CreateKernel2 createKernel2
Definition: registry.h:78
Model *(* CreateKernel1)(const QSARData &q, int k, double p1, double p2)
Definition: registry.h:41
double default_gridsearch_stepwidth
Definition: registry.h:126
std::map< int, RegistryEntry >::iterator RegistryEntryIterator
Definition: registry.h:90
double default_gridsearch_par2_start
Definition: registry.h:130
int default_no_boostrap_samples
Definition: registry.h:115
#define BALL_EXPORT
Definition: COMMON/global.h:50
double default_correlation_cutoff
Definition: registry.h:124