openModeller  Version 1.5.0
AbstractBestSubsets Class Referenceabstract

#include <AbstractBestSubsets.hh>

Inheritance diagram for AbstractBestSubsets:
Inheritance graph
Collaboration diagram for AbstractBestSubsets:
Collaboration graph

Public Member Functions

 AbstractBestSubsets (AlgMetadata const *)
 
virtual ~AbstractBestSubsets ()=0
 
int needNormalization ()
 
int initialize ()
 
int iterate ()
 
int done () const
 
float getProgress () const
 
Scalar getValue (const Sample &x) const
 
int getConvergence (Scalar *const val) const
 
- 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 ()
 
NormalizergetNormalizer () 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 ()
 

Protected Member Functions

virtual void _getConfiguration (ConfigurationPtr &) const
 
virtual 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

std::string _subAlgorithm
 
- Protected Attributes inherited from AlgorithmImpl
SamplerPtr _samp
 
Normalizer_normalizerPtr
 
ParamSetType _param
 

Private Member Functions

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
 

Detailed Description

Declaration of Best Subsets Procedure base class

Author
Ricardo Scachetti Pereira (rpere.nosp@m.ira@.nosp@m.ku.ed.nosp@m.u)
Date
2004-12-10
Id:
AbstractBestSubsets.hh 5932 2014-03-17 22:51:58Z rdg

LICENSE INFORMATION

Copyright(c), The Center for Research, University of Kansas, 2385 Irving Hill Road, Lawrence, KS 66044-4755, USA.

http://www.nhm.ku.edu

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:

http://www.gnu.org/copyleft/gpl.html 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 53 of file AbstractBestSubsets.hh.

Constructor & Destructor Documentation

AbstractBestSubsets::~AbstractBestSubsets ( )
pure virtual

Definition at line 91 of file AbstractBestSubsets.cpp.

References _activeRun, _bestRun, _finishedRun, and _numFinishedRuns.

Member Function Documentation

void AbstractBestSubsets::_getConfiguration ( ConfigurationPtr config) const
protectedvirtual

Reimplemented from AlgorithmImpl.

Definition at line 114 of file AbstractBestSubsets.cpp.

References _bestRun, _done, _numBestRuns, and AlgorithmRun::getAlgorithm().

Here is the call graph for this function:

void AbstractBestSubsets::_setConfiguration ( const ConstConfigurationPtr config)
protectedvirtual

Reimplemented from AlgorithmImpl.

Definition at line 141 of file AbstractBestSubsets.cpp.

References _bestRun, _done, _numBestRuns, and AlgorithmFactory::newAlgorithm().

Here is the call graph for this function:

int AbstractBestSubsets::calculateBestSubset ( )
private

Definition at line 423 of file AbstractBestSubsets.cpp.

References _bestRun, _commissionThreshold, _finishedRun, _modelsUnderOmission, _numBestRuns, _numFinishedRuns, _totalRuns, Log::info(), Log::instance(), printListOfRuns(), and sortRuns().

Referenced by iterate().

Here is the call graph for this function:

int AbstractBestSubsets::done ( ) const
virtual

Check if the model generation is completed (e.g. convergence point has been met.

Returns
Implementation specific but usually 1 for completion.

Reimplemented from AlgorithmImpl.

Definition at line 500 of file AbstractBestSubsets.cpp.

References _done.

Referenced by getProgress().

int AbstractBestSubsets::earlyTerminationConditionMet ( )
private
int AbstractBestSubsets::getConvergence ( Scalar *const  val) const
virtual

Returns a value that represents the convergence of the algorithm expressed as a number between 0 and 1 where 0 represents model completion.

Returns
Parameters
val

Reimplemented from AlgorithmImpl.

Definition at line 560 of file AbstractBestSubsets.cpp.

float AbstractBestSubsets::getProgress ( ) const
virtual

Return progress so far

Reimplemented from AlgorithmImpl.

Definition at line 508 of file AbstractBestSubsets.cpp.

References _activeRun, _currentModelsUnderOmissionThreshold, _maxProgress, _modelsUnderOmission, _numActiveRuns, _numFinishedRuns, _softOmissionThreshold, _totalRuns, done(), and AlgorithmRun::getProgress().

Here is the call graph for this function:

Scalar AbstractBestSubsets::getValue ( const Sample x) const
virtual

This method is used when projecting the model.

Note
This method is inherited from the Algorithm class
Returns
Parameters
xPointer 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 543 of file AbstractBestSubsets.cpp.

References _bestRun, _done, _numBestRuns, and AlgorithmRun::getValue().

Here is the call graph for this function:

int AbstractBestSubsets::initialize ( )
virtual

Initialize data structures

Note
This method is inherited from the Algorithm class
Returns
0 on error

Implements AlgorithmImpl.

Definition at line 228 of file AbstractBestSubsets.cpp.

References _activeRun, _commissionSampleSize, _commissionThreshold, _finishedRun, _maxThreads, _modelsUnderOmission, _omissionThreshold, _softOmissionThreshold, _subAlgorithm, _totalRuns, _trainProp, Log::error(), AlgorithmImpl::getParameter(), Log::instance(), and Log::warn().

Here is the call graph for this function:

int AbstractBestSubsets::iterate ( )
virtual

Start model execution (build the model). Consists of a single GARP run. It is also the control loop for the threads

Returns
0 on error

Reimplemented from AlgorithmImpl.

Definition at line 311 of file AbstractBestSubsets.cpp.

References _activeRun, _commissionSampleSize, _done, _maxThreads, _numActiveRuns, _numFinishedRuns, AlgorithmImpl::_param, AlgorithmImpl::_samp, _subAlgorithm, _totalRuns, _trainProp, calculateBestSubset(), earlyTerminationConditionMet(), AlgorithmRun::initialize(), AlgorithmFactory::newAlgorithm(), numActiveThreads(), AlgorithmRun::run(), SLEEP, and splitSampler().

Here is the call graph for this function:

int AbstractBestSubsets::needNormalization ( )
virtual

This method is used when you want to ensure that all variables in all environmental layers are scaled to the same value range. GARP requires values to be normalized between -1.0 and 1.0.

Returns
Always return 1 for GARP_BS.

Reimplemented from AlgorithmImpl.

Definition at line 191 of file AbstractBestSubsets.cpp.

References AlgorithmImpl::_normalizerPtr, AlgorithmImpl::_samp, _subAlgorithm, Normalizer::computeNormalization(), error, Log::error(), AlgorithmImpl::getParameter(), Log::info(), Log::instance(), AlgorithmFactory::newAlgorithm(), and AlgorithmImpl::setNormalization().

Here is the call graph for this function:

int AbstractBestSubsets::numActiveThreads ( )
private
void AbstractBestSubsets::sortRuns ( AlgorithmRun **  runList,
int  nelements,
int  errorType 
)
private

Definition at line 470 of file AbstractBestSubsets.cpp.

References AlgorithmRun::getError().

Referenced by calculateBestSubset().

Here is the call graph for this function:

Member Data Documentation

AlgorithmRun** AbstractBestSubsets::_activeRun
private
AlgorithmRun** AbstractBestSubsets::_bestRun
private
int AbstractBestSubsets::_commissionSampleSize
private

Definition at line 131 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), initialize(), and iterate().

double AbstractBestSubsets::_commissionThreshold
private

Definition at line 130 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), calculateBestSubset(), and initialize().

int AbstractBestSubsets::_currentModelsUnderOmissionThreshold
private
int AbstractBestSubsets::_done
private
AlgorithmRun** AbstractBestSubsets::_finishedRun
private
float AbstractBestSubsets::_maxProgress
mutableprivate

Definition at line 150 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), and getProgress().

int AbstractBestSubsets::_maxThreads
private

Definition at line 132 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), initialize(), and iterate().

int AbstractBestSubsets::_modelsUnderOmission
private
int AbstractBestSubsets::_numActiveRuns
private
int AbstractBestSubsets::_numBestRuns
private
int AbstractBestSubsets::_numFinishedRuns
private
double AbstractBestSubsets::_omissionThreshold
private

Definition at line 128 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), initialize(), and numActiveThreads().

bool AbstractBestSubsets::_softOmissionThreshold
private
std::string AbstractBestSubsets::_subAlgorithm
mutableprotected
int AbstractBestSubsets::_totalRuns
private
double AbstractBestSubsets::_trainProp
private

Definition at line 126 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), initialize(), and iterate().


The documentation for this class was generated from the following files: