openModeller
Version 1.5.0
|
#include <best_subsets.hh>
Public Member Functions | |
BestSubsets (AlgMetadata *metadata) | |
virtual | ~BestSubsets () |
int | initialize () |
int | iterate () |
int | done () const |
float | getProgress () const |
Scalar | getValue (const Sample &x) const |
int | getConvergence (Scalar *const val) const |
void | printListOfRuns (string msg, AlgorithmRun **runs, int numOfRuns) |
Public Member Functions inherited from AlgorithmImpl | |
AlgorithmImpl (AlgMetadata const *metadata) | |
virtual | ~AlgorithmImpl () |
void | setParameters (int nparam, AlgParameter const *param) |
void | setParameters (const ParamSetType &) |
std::string const | getID () const |
AlgMetadata const * | getMetadata () const |
AlgorithmPtr | getFreshCopy () |
virtual int | supportsModelProjection () const |
Model | createModel (const SamplerPtr &samp, CallbackWrapper *func=0) |
void | setSampler (const SamplerPtr &samp) |
virtual int | finalize () |
virtual int | needNormalization () |
Normalizer * | getNormalizer () const |
void | setNormalization (const SamplerPtr &samp) const |
void | setNormalization (const EnvironmentPtr &env) const |
virtual Model | getModel () const |
ConfigurationPtr | getConfiguration () const |
void | setConfiguration (const ConstConfigurationPtr &) |
Public Member Functions inherited from Configurable | |
virtual | ~Configurable () |
Public Member Functions inherited from BSAlgorithmFactory | |
virtual | ~BSAlgorithmFactory () |
Protected Member Functions | |
void | _getConfiguration (ConfigurationPtr &) const |
void | _setConfiguration (const ConstConfigurationPtr &) |
Protected Member Functions inherited from AlgorithmImpl | |
int | dimDomain () |
int | getParameter (std::string const &name, std::string *value) |
int | getParameter (std::string const &name, double *value) |
int | getParameter (std::string const &name, float *value) |
int | getParameter (std::string const &name, int *value) |
Protected Attributes | |
int | _nparam |
AlgParameter * | _alg_params |
Protected Attributes inherited from AlgorithmImpl | |
SamplerPtr | _samp |
Normalizer * | _normalizerPtr |
ParamSetType | _param |
Private Member Functions | |
virtual AlgorithmImpl * | getBSAlgorithm ()=0 |
virtual int | transferParametersToAlgorithm ()=0 |
int | numActiveThreads () |
int | earlyTerminationConditionMet () |
int | calculateBestSubset () |
void | sortRuns (AlgorithmRun **runList, int nelements, int errorType) |
Private Attributes | |
double | _trainProp |
int | _totalRuns |
double | _omissionThreshold |
int | _modelsUnderOmission |
double | _commissionThreshold |
int | _commissionSampleSize |
int | _maxThreads |
bool | _softOmissionThreshold |
int | _currentModelsUnderOmissionThreshold |
AlgorithmRun ** | _finishedRun |
AlgorithmRun ** | _activeRun |
AlgorithmRun ** | _bestRun |
int | _numFinishedRuns |
int | _numActiveRuns |
int | _numBestRuns |
int | _done |
float | _maxProgress |
Additional Inherited Members | |
Public Types inherited from AlgorithmImpl | |
typedef std::map< icstring, std::string > | ParamSetType |
Implements Best Subset Procedure (Anderson et al. 2003).
It runs "n" Garp models, filter the best ones based on the procedure defined by Anderson et al. 2003 and sum them to obtain a probability map for the species distribution.
Current implementation uses multi-threading to run multiple Garp runs in parallel. Takes advantage of multi-processor servers and workstations.
Definition at line 55 of file best_subsets.hh.
BestSubsets::BestSubsets | ( | AlgMetadata * | metadata | ) |
Definition at line 66 of file best_subsets.cpp.
References _activeRun, _alg_params, _bestRun, _commissionSampleSize, _commissionThreshold, _currentModelsUnderOmissionThreshold, _done, _finishedRun, _maxProgress, _modelsUnderOmission, _nparam, _numActiveRuns, _numFinishedRuns, _omissionThreshold, _softOmissionThreshold, _totalRuns, and _trainProp.
|
virtual |
Definition at line 95 of file best_subsets.cpp.
References _activeRun, _alg_params, _bestRun, _finishedRun, and _numFinishedRuns.
|
protectedvirtual |
Reimplemented from AlgorithmImpl.
Definition at line 458 of file best_subsets.cpp.
References _bestRun, _done, _numBestRuns, and AlgorithmRun::getAlgorithm().
|
protectedvirtual |
Reimplemented from AlgorithmImpl.
Definition at line 486 of file best_subsets.cpp.
References _bestRun, _done, _numBestRuns, and AlgorithmFactory::newAlgorithm().
|
private |
Definition at line 313 of file best_subsets.cpp.
References _bestRun, _commissionThreshold, _finishedRun, _modelsUnderOmission, _numBestRuns, _numFinishedRuns, _totalRuns, Log::info(), Log::instance(), printListOfRuns(), and sortRuns().
Referenced by iterate().
|
virtual |
Check if the model generation is completed (e.g. convergence point has been met.
Reimplemented from AlgorithmImpl.
Definition at line 390 of file best_subsets.cpp.
References _done.
Referenced by getProgress().
|
private |
Definition at line 306 of file best_subsets.cpp.
References _currentModelsUnderOmissionThreshold, _modelsUnderOmission, and _softOmissionThreshold.
Referenced by iterate().
|
privatepure virtual |
Implements BSAlgorithmFactory.
Implemented in GarpBestSubsets, and DgGarpBestSubsets.
|
virtual |
Returns a value that represents the convergence of the algorithm expressed as a number between 0 and 1 where 0 represents model completion.
val |
Reimplemented from AlgorithmImpl.
Definition at line 450 of file best_subsets.cpp.
|
virtual |
Return progress so far
Reimplemented from AlgorithmImpl.
Definition at line 398 of file best_subsets.cpp.
References _activeRun, _currentModelsUnderOmissionThreshold, _maxProgress, _modelsUnderOmission, _numActiveRuns, _numFinishedRuns, _softOmissionThreshold, _totalRuns, done(), and AlgorithmRun::getProgress().
This method is used when projecting the model.
x | Pointer to a vector of openModeller Scalar type (currently double). The vector should contain values looked up on the environmental variable layers into which the mode is being projected. |
Implements AlgorithmImpl.
Definition at line 433 of file best_subsets.cpp.
References _bestRun, _done, _numBestRuns, and AlgorithmRun::getValue().
|
virtual |
Initialize data structures
Implements AlgorithmImpl.
Definition at line 120 of file best_subsets.cpp.
References _activeRun, _commissionSampleSize, _commissionThreshold, _finishedRun, _maxThreads, _modelsUnderOmission, _omissionThreshold, _softOmissionThreshold, _totalRuns, _trainProp, Log::error(), AlgorithmImpl::getParameter(), Log::instance(), transferParametersToAlgorithm(), and Log::warn().
|
virtual |
Start model execution (build the model). Consists of a single GARP run. It is also the control loop for the threads
Reimplemented from AlgorithmImpl.
Definition at line 198 of file best_subsets.cpp.
References _activeRun, _alg_params, _commissionSampleSize, _done, _maxThreads, _nparam, _numActiveRuns, _numFinishedRuns, AlgorithmImpl::_samp, _totalRuns, _trainProp, calculateBestSubset(), Log::debug(), earlyTerminationConditionMet(), AlgorithmRun::initialize(), Log::instance(), numActiveThreads(), AlgorithmRun::run(), SLEEP, and splitSampler().
|
private |
Definition at line 273 of file best_subsets.cpp.
References _activeRun, _currentModelsUnderOmissionThreshold, _finishedRun, _numActiveRuns, _numFinishedRuns, _omissionThreshold, _softOmissionThreshold, AlgorithmRun::getOmission(), and AlgorithmRun::running().
Referenced by iterate().
void BestSubsets::printListOfRuns | ( | string | msg, |
AlgorithmRun ** | runs, | ||
int | numOfRuns | ||
) |
Definition at line 53 of file best_subsets.cpp.
References AlgorithmRun::getCommission(), and AlgorithmRun::getId().
Referenced by calculateBestSubset().
|
private |
Definition at line 360 of file best_subsets.cpp.
References AlgorithmRun::getError(), Log::info(), and Log::instance().
Referenced by calculateBestSubset().
|
privatepure virtual |
Implemented in GarpBestSubsets, and DgGarpBestSubsets.
Referenced by initialize().
|
private |
Definition at line 147 of file best_subsets.hh.
Referenced by BestSubsets(), getProgress(), initialize(), iterate(), numActiveThreads(), and ~BestSubsets().
|
protected |
Definition at line 115 of file best_subsets.hh.
Referenced by BestSubsets(), iterate(), DgGarpBestSubsets::transferParametersToAlgorithm(), GarpBestSubsets::transferParametersToAlgorithm(), and ~BestSubsets().
|
private |
Definition at line 148 of file best_subsets.hh.
Referenced by _getConfiguration(), _setConfiguration(), BestSubsets(), calculateBestSubset(), getValue(), and ~BestSubsets().
|
private |
Definition at line 137 of file best_subsets.hh.
Referenced by BestSubsets(), initialize(), and iterate().
|
private |
Definition at line 136 of file best_subsets.hh.
Referenced by BestSubsets(), calculateBestSubset(), and initialize().
|
private |
Definition at line 141 of file best_subsets.hh.
Referenced by BestSubsets(), earlyTerminationConditionMet(), getProgress(), and numActiveThreads().
|
private |
Definition at line 154 of file best_subsets.hh.
Referenced by _getConfiguration(), _setConfiguration(), BestSubsets(), done(), getValue(), and iterate().
|
private |
Definition at line 146 of file best_subsets.hh.
Referenced by BestSubsets(), calculateBestSubset(), initialize(), numActiveThreads(), and ~BestSubsets().
|
mutableprivate |
Definition at line 156 of file best_subsets.hh.
Referenced by BestSubsets(), and getProgress().
|
private |
Definition at line 138 of file best_subsets.hh.
Referenced by initialize(), and iterate().
|
private |
Definition at line 135 of file best_subsets.hh.
Referenced by BestSubsets(), calculateBestSubset(), earlyTerminationConditionMet(), getProgress(), and initialize().
|
protected |
Definition at line 114 of file best_subsets.hh.
Referenced by BestSubsets(), iterate(), DgGarpBestSubsets::transferParametersToAlgorithm(), and GarpBestSubsets::transferParametersToAlgorithm().
|
private |
Definition at line 151 of file best_subsets.hh.
Referenced by BestSubsets(), getProgress(), iterate(), and numActiveThreads().
|
private |
Definition at line 152 of file best_subsets.hh.
Referenced by _getConfiguration(), _setConfiguration(), calculateBestSubset(), and getValue().
|
private |
Definition at line 150 of file best_subsets.hh.
Referenced by BestSubsets(), calculateBestSubset(), getProgress(), iterate(), numActiveThreads(), and ~BestSubsets().
|
private |
Definition at line 134 of file best_subsets.hh.
Referenced by BestSubsets(), initialize(), and numActiveThreads().
|
private |
Definition at line 140 of file best_subsets.hh.
Referenced by BestSubsets(), earlyTerminationConditionMet(), getProgress(), initialize(), and numActiveThreads().
|
private |
Definition at line 133 of file best_subsets.hh.
Referenced by BestSubsets(), calculateBestSubset(), getProgress(), initialize(), and iterate().
|
private |
Definition at line 132 of file best_subsets.hh.
Referenced by BestSubsets(), initialize(), and iterate().