openModeller
Version 1.4.0
|
00001 00030 #ifndef _BEST_SUBSETS_HH_ 00031 #define _BEST_SUBSETS_HH_ 00032 00033 #include <openmodeller/om.hh> 00034 00035 #include "bs_algorithm_factory.hh" 00036 #include "garp_run.hh" 00037 00038 #include <string> 00039 using std::string; 00040 00041 /****************************************************************/ 00042 /************************* GARP Algorithm ***********************/ 00043 00055 class BestSubsets : public AlgorithmImpl, public BSAlgorithmFactory 00056 { 00057 public: 00058 00059 BestSubsets(AlgMetadata * metadata); 00060 virtual ~BestSubsets(); 00061 00066 int initialize(); 00067 00072 int iterate(); 00073 00078 int done() const; 00079 00081 float getProgress() const; 00082 00083 // 00084 // Methods used to project the model 00085 // 00086 00095 Scalar getValue( const Sample& x ) const; 00096 00103 int getConvergence( Scalar * const val ) const; 00104 00105 /* 00106 */ 00107 void printListOfRuns(string msg, AlgorithmRun ** runs, int numOfRuns); 00108 00109 protected: 00110 00111 void _getConfiguration( ConfigurationPtr& ) const; 00112 void _setConfiguration( const ConstConfigurationPtr & ); 00113 00114 int _nparam; 00115 AlgParameter * _alg_params; 00116 00117 private: 00118 00119 virtual AlgorithmImpl * getBSAlgorithm() = 0; 00120 virtual int transferParametersToAlgorithm() = 0; 00121 00122 int numActiveThreads(); 00123 int earlyTerminationConditionMet(); 00124 int calculateBestSubset(); 00125 void sortRuns(AlgorithmRun ** runList, int nelements, int errorType); 00126 00127 00128 // 00129 // best subsets parameters 00130 // 00131 00132 double _trainProp; 00133 int _totalRuns; 00134 double _omissionThreshold; 00135 int _modelsUnderOmission; 00136 double _commissionThreshold; 00137 int _commissionSampleSize; 00138 int _maxThreads; 00139 00140 bool _softOmissionThreshold; 00141 int _currentModelsUnderOmissionThreshold; 00142 00143 // 00144 // Internal data structures for Best Subsets 00145 // 00146 AlgorithmRun ** _finishedRun; 00147 AlgorithmRun ** _activeRun; 00148 AlgorithmRun ** _bestRun; 00149 00150 int _numFinishedRuns; 00151 int _numActiveRuns; 00152 int _numBestRuns; 00153 00154 int _done; 00155 00156 mutable float _maxProgress; 00157 }; 00158 00159 00160 #endif 00161