BALL
1.4.1
|
00001 /* registry.h 00002 * 00003 * Copyright (C) 2009 Marcel Schumann 00004 * 00005 * This file is part of QuEasy -- A Toolbox for Automated QSAR Model 00006 * Construction and Validation. 00007 * QuEasy is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3 of the License, or (at 00010 * your option) any later version. 00011 * 00012 * QuEasy is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef QSAR_REGISTRY 00022 #define QSAR_REGISTRY 00023 00024 #ifndef MODEL_FACTORY_H 00025 #include <BALL/QSAR/modelFactory.h> 00026 #endif 00027 00028 #include <map> 00029 00030 #ifdef BALL_HAS_LIBSVM 00031 # include <BALL/QSAR/libsvmModel.h> 00032 #endif 00033 00034 namespace BALL 00035 { 00036 namespace QSAR 00037 { 00038 class QSARData; 00039 00040 typedef Model* (*CreateMethod) (const QSARData& q); 00041 typedef Model* (*CreateKernel1) (const QSARData& q, int k, double p1, double p2); 00042 typedef Model* (*CreateKernel2) (const QSARData& q, String s1, String s2); 00043 00044 class Registry; 00045 00046 class BALL_EXPORT RegistryEntry 00047 { 00048 public: 00049 00054 RegistryEntry(bool k, bool r, String n, String ab, CreateMethod c0); 00055 00060 RegistryEntry(bool k, bool r, String n, String ab, CreateKernel1 c1, CreateKernel2 c2); 00061 00062 RegistryEntry(const RegistryEntry& entry); 00063 00064 ~RegistryEntry(); 00065 00066 const std::map<uint,String>* getStatistics(); 00067 String getStatName(int s); 00068 00069 bool kernel; 00070 bool regression; // regression or classification?! 00071 bool latent_variables; // is this a latent variable model?! 00072 std::multiset<int> optimizableParameters; 00073 //bool optimizable; 00074 String name; // name of the Model 00075 String name_abreviation; 00076 CreateMethod create; 00077 CreateKernel1 createKernel1; 00078 CreateKernel2 createKernel2; 00079 vector<String> parameterNames; 00080 vector<double> parameterDefaults; 00081 Registry* getRegistry(); 00082 00083 private: 00084 Registry* registry_; 00085 00086 friend class Registry; 00087 }; 00088 00089 00090 typedef std::map<int,RegistryEntry>::iterator RegistryEntryIterator; 00091 00092 class BALL_EXPORT Registry 00093 { 00094 public: 00095 Registry(); 00096 00097 ~Registry(); 00098 00100 double default_kernel_par1; 00101 00103 double default_kernel_par2; 00104 00106 double default_rbf_par; 00107 00109 int default_k; 00110 00112 int default_no_permutations; 00113 00115 int default_no_boostrap_samples; 00116 00118 double default_valdition_fraction; 00119 00121 int default_nested_folds; 00122 00124 double default_correlation_cutoff; 00125 00126 double default_gridsearch_stepwidth; 00127 int default_gridsearch_recursion; 00128 int default_gridsearch_steps; 00129 double default_gridsearch_par1_start; 00130 double default_gridsearch_par2_start; 00131 00132 void addEntry(RegistryEntry entry, int uniqueID); 00133 00135 RegistryEntry* getEntry(String model_name); 00136 00138 RegistryEntry* getEntry(int ID); 00139 00141 int getModelNo(String model_name); 00142 00143 String getClassificationStatisticName(uint no); 00144 String getRegressionStatisticName(uint no); 00145 String getFeatureSelectionName(uint no); 00146 String getValidationName(uint no); 00147 const std::map<uint,String>* getClassificationStatistics(); 00148 const std::map<uint,String>* getRegressionStatistics(); 00149 00151 RegistryEntryIterator beginEntry(); 00152 00154 RegistryEntryIterator endEntry(); 00155 00156 00157 private: 00158 std::map<int,RegistryEntry> registered_models; 00159 00161 std::map<String,int> model_map; 00162 00163 std::map<uint,String> classification_statistics; 00164 std::map<uint,String> regression_statistics; 00165 std::map<uint,String> feature_selection_names; 00166 std::map<uint,String> validation_names; 00167 00168 friend class RegistryEntry; 00169 }; 00170 00171 00172 } 00173 } 00174 00175 #endif // QSAR_REGISTRY