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 #ifndef BALL_QSAR_REGISTRY_H
2 #define BALL_QSAR_REGISTRY_H
3 
4 #ifndef MODEL_FACTORY_H
6 #endif
7 
8 #include <map>
9 
10 #ifdef BALL_HAS_LIBSVM
11 # include <BALL/QSAR/libsvmModel.h>
12 #endif
13 
14 namespace BALL
15 {
16  namespace QSAR
17  {
18  class QSARData;
19 
20  typedef Model* (*CreateMethod) (const QSARData& q);
21  typedef Model* (*CreateKernel1) (const QSARData& q, int k, double p1, double p2);
22  typedef Model* (*CreateKernel2) (const QSARData& q, String s1, String s2);
23 
24  class Registry;
25 
27  {
28  public:
29 
34  RegistryEntry(bool k, bool r, String n, String ab, CreateMethod c0);
35 
40  RegistryEntry(bool k, bool r, String n, String ab, CreateKernel1 c1, CreateKernel2 c2);
41 
42  RegistryEntry(const RegistryEntry& entry);
43 
44  ~RegistryEntry();
45 
46  const std::map<unsigned int,String>* getStatistics();
47  String getStatName(int s);
48 
49  bool kernel;
50  bool regression; // regression or classification?!
51  bool latent_variables; // is this a latent variable model?!
52  std::multiset<int> optimizableParameters;
53  //bool optimizable;
54  String name; // name of the Model
59  vector<String> parameterNames;
60  vector<double> parameterDefaults;
61  Registry* getRegistry();
62 
63  private:
64  Registry* registry_;
65 
66  friend class Registry;
67  };
68 
69 
70  typedef std::map<int,RegistryEntry>::iterator RegistryEntryIterator;
71 
73  {
74  public:
75  Registry();
76 
77  ~Registry();
78 
81 
84 
87 
89  int default_k;
90 
93 
96 
99 
102 
105 
111 
112  void addEntry(RegistryEntry entry, int uniqueID);
113 
115  RegistryEntry* getEntry(String model_name);
116 
118  RegistryEntry* getEntry(int ID);
119 
121  int getModelNo(String model_name);
122 
123  String getClassificationStatisticName(unsigned int no);
124  String getRegressionStatisticName(unsigned int no);
125  String getFeatureSelectionName(unsigned int no);
126  String getValidationName(unsigned int no);
127  const std::map<unsigned int,String>* getClassificationStatistics();
128  const std::map<unsigned int,String>* getRegressionStatistics();
129 
131  RegistryEntryIterator beginEntry();
132 
134  RegistryEntryIterator endEntry();
135 
136 
137  private:
138  std::map<int,RegistryEntry> registered_models;
139 
141  std::map<String,int> model_map;
142 
143  std::map<unsigned int,String> classification_statistics;
144  std::map<unsigned int,String> regression_statistics;
145  std::map<unsigned int,String> feature_selection_names;
146  std::map<unsigned int,String> validation_names;
147 
148  friend class RegistryEntry;
149  };
150 
151 
152  }
153 }
154 
155 #endif // BALL_QSAR_REGISTRY_H
Model *(* CreateMethod)(const QSARData &q)
Definition: registry.h:20
int default_no_permutations
Definition: registry.h:92
double default_gridsearch_par1_start
Definition: registry.h:109
int default_gridsearch_recursion
Definition: registry.h:107
double default_kernel_par2
Definition: registry.h:83
double default_rbf_par
Definition: registry.h:86
Model *(* CreateKernel2)(const QSARData &q, String s1, String s2)
Definition: registry.h:22
CreateKernel1 createKernel1
Definition: registry.h:57
vector< String > parameterNames
Definition: registry.h:59
double default_kernel_par1
Definition: registry.h:80
int default_gridsearch_steps
Definition: registry.h:108
vector< double > parameterDefaults
Definition: registry.h:60
std::multiset< int > optimizableParameters
Definition: registry.h:52
BALL_EXTERN_VARIABLE const double k
Definition: constants.h:93
CreateMethod create
Definition: registry.h:56
double default_valdition_fraction
Definition: registry.h:98
CreateKernel2 createKernel2
Definition: registry.h:58
Model *(* CreateKernel1)(const QSARData &q, int k, double p1, double p2)
Definition: registry.h:21
double default_gridsearch_stepwidth
Definition: registry.h:106
std::map< int, RegistryEntry >::iterator RegistryEntryIterator
Definition: registry.h:70
double default_gridsearch_par2_start
Definition: registry.h:110
int default_no_boostrap_samples
Definition: registry.h:95
#define BALL_EXPORT
Definition: COMMON/global.h:50
double default_correlation_cutoff
Definition: registry.h:104