openModeller  Version 1.4.0
AbstractBestSubsets Class Reference

#include <AbstractBestSubsets.hh>

Inheritance diagram for AbstractBestSubsets:
Collaboration diagram for AbstractBestSubsets:

List of all members.

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

Protected Member Functions

virtual void _getConfiguration (ConfigurationPtr &) const
virtual void _setConfiguration (const ConstConfigurationPtr &)

Protected Attributes

std::string _subAlgorithm

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

Detailed Description

Declaration of Best Subsets Procedure base class

Author:
Ricardo Scachetti Pereira (rpereira@ku.edu)
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


Member Function Documentation

void AbstractBestSubsets::_getConfiguration ( ConfigurationPtr config) const [protected, virtual]

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) [protected, virtual]

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::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::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:

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:

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:

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

float AbstractBestSubsets::_maxProgress [mutable, private]

Definition at line 150 of file AbstractBestSubsets.hh.

Referenced by AbstractBestSubsets(), and getProgress().

Definition at line 132 of file AbstractBestSubsets.hh.

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

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: