openModeller
Version 1.4.0
|
00001 00030 #ifndef _BEST_SUBSETS_HH_ 00031 #define _BEST_SUBSETS_HH_ 00032 00033 #include <string> 00034 #include <openmodeller/om.hh> 00035 00036 #include "AlgorithmRun.hh" 00037 00038 00039 /****************************************************************/ 00040 /************************* GARP Algorithm ***********************/ 00041 00053 class AbstractBestSubsets : public AlgorithmImpl 00054 { 00055 public: 00056 AbstractBestSubsets( AlgMetadata const * ); 00057 virtual ~AbstractBestSubsets() = 0; 00058 00064 int needNormalization(); 00065 00070 int initialize(); 00071 00076 int iterate(); 00077 00082 int done() const; 00083 00085 float getProgress() const; 00086 00087 // 00088 // Methods used to project the model 00089 // 00090 00099 Scalar getValue( const Sample& x ) const; 00100 00107 int getConvergence( Scalar * const val ) const; 00108 00109 /* 00110 */ 00111 protected: 00112 virtual void _getConfiguration( ConfigurationPtr& ) const; 00113 virtual void _setConfiguration( const ConstConfigurationPtr & ); 00114 00115 mutable std::string _subAlgorithm; //< mutable so it can be assigned in needNormalization if necessary 00116 00117 private: 00118 int numActiveThreads(); 00119 int earlyTerminationConditionMet(); 00120 int calculateBestSubset(); 00121 void sortRuns(AlgorithmRun ** runList, int nelements, int errorType); 00122 00123 // 00124 // best subsets parameters 00125 // 00126 double _trainProp; 00127 int _totalRuns; 00128 double _omissionThreshold; 00129 int _modelsUnderOmission; 00130 double _commissionThreshold; 00131 int _commissionSampleSize; 00132 int _maxThreads; 00133 00134 bool _softOmissionThreshold; 00135 int _currentModelsUnderOmissionThreshold; 00136 00137 // 00138 // Internal data structures for Best Subsets 00139 // 00140 AlgorithmRun ** _finishedRun; 00141 AlgorithmRun ** _activeRun; 00142 AlgorithmRun ** _bestRun; 00143 00144 int _numFinishedRuns; 00145 int _numActiveRuns; 00146 int _numBestRuns; 00147 00148 int _done; 00149 00150 mutable float _maxProgress; 00151 00152 }; 00153 00154 00155 #endif 00156