openModeller  Version 1.5.0
ConsensusAlgorithm Class Reference

#include <consensus.hh>

Inheritance diagram for ConsensusAlgorithm:
Inheritance graph
Collaboration diagram for ConsensusAlgorithm:
Collaboration graph

Public Member Functions

 ConsensusAlgorithm ()
 
 ~ConsensusAlgorithm ()
 
int needNormalization ()
 
int initialize ()
 
int iterate ()
 
float getProgress () const
 
int done () 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

void _getConfiguration (ConfigurationPtr &) const
 
void _setConfiguration (const ConstConfigurationPtr &)
 
bool _setAlgorithm (std::string alg_str)
 
- 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

bool _done
 
bool _initialized
 
Sample _weights
 
Scalar _sum_weights
 
Sample _thresholds
 
vector< AlgorithmPtr_algs
 
int _num_algs
 
int _agreement
 
vector< Normalizer * > _norms
 
- Protected Attributes inherited from AlgorithmImpl
SamplerPtr _samp
 
Normalizer_normalizerPtr
 
ParamSetType _param
 

Additional Inherited Members

- Public Types inherited from AlgorithmImpl
typedef std::map< icstring,
std::string > 
ParamSetType
 

Detailed Description

Declaration of Consensus algorithm class.

Author
Renato De Giovanni (renato [at] cria org br)
Id:
consensus.hh 5624 2012-09-08 16:46:57Z rdg

LICENSE INFORMATION

Copyright(c) 2011 by CRIA - Centro de Referencia em Informacao Ambiental

http://www.cria.org.br

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 Algorithm to generate models with other algorithms.

Definition at line 41 of file consensus.hh.

Constructor & Destructor Documentation

ConsensusAlgorithm::ConsensusAlgorithm ( )

Definition at line 193 of file consensus.cpp.

ConsensusAlgorithm::~ConsensusAlgorithm ( )

Definition at line 206 of file consensus.cpp.

References _algs, and _norms.

Member Function Documentation

void ConsensusAlgorithm::_getConfiguration ( ConfigurationPtr config) const
protectedvirtual

Reimplemented from AlgorithmImpl.

Definition at line 548 of file consensus.cpp.

References _algs, _done, _num_algs, and _thresholds.

bool ConsensusAlgorithm::_setAlgorithm ( std::string  alg_str)
protected

Definition at line 330 of file consensus.cpp.

References _algs, _norms, CONSENSUS_LOG_PREFIX, Log::error(), Log::instance(), and AlgorithmFactory::newAlgorithm().

Referenced by initialize().

Here is the call graph for this function:

void ConsensusAlgorithm::_setConfiguration ( const ConstConfigurationPtr config)
protectedvirtual
int ConsensusAlgorithm::done ( ) const
virtual

Return != 0 if algorithm finished.

Reimplemented from AlgorithmImpl.

Definition at line 494 of file consensus.cpp.

References _done.

Referenced by iterate().

int ConsensusAlgorithm::getConvergence ( Scalar *const  val) const
virtual

Returns the algorithm's convergence value at the moment

Reimplemented from AlgorithmImpl.

Definition at line 539 of file consensus.cpp.

float ConsensusAlgorithm::getProgress ( ) const
virtual

Returns progress so far (between 0.0 and 1.0)

Reimplemented from AlgorithmImpl.

Definition at line 478 of file consensus.cpp.

References _algs, and _num_algs.

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

The algorithm must return the occurrence probability at the given environment conditions.

Parameters
xEnvironmental conditions.
Returns
The occurrence probability in the range [0,1].

Implements AlgorithmImpl.

Definition at line 502 of file consensus.cpp.

References _agreement, _algs, _norms, _num_algs, _sum_weights, _thresholds, and _weights.

int ConsensusAlgorithm::initialize ( )
virtual
int ConsensusAlgorithm::iterate ( )
virtual

One step further on the training. Return 0 if something wrong happened.

Reimplemented from AlgorithmImpl.

Definition at line 419 of file consensus.cpp.

References _algs, _done, _norms, _num_algs, AlgorithmImpl::_samp, _thresholds, and done().

Here is the call graph for this function:

int ConsensusAlgorithm::needNormalization ( )
virtual

The algorithm should return != 0 if it needs normalization of environmental variables (non categorical ones).

Reimplemented from AlgorithmImpl.

Definition at line 219 of file consensus.cpp.

Referenced by initialize().

Member Data Documentation

int ConsensusAlgorithm::_agreement
protected

Definition at line 78 of file consensus.hh.

Referenced by _setConfiguration(), getValue(), and initialize().

vector<AlgorithmPtr> ConsensusAlgorithm::_algs
protected
bool ConsensusAlgorithm::_done
protected

Definition at line 66 of file consensus.hh.

Referenced by _getConfiguration(), _setConfiguration(), done(), and iterate().

bool ConsensusAlgorithm::_initialized
protected

Definition at line 68 of file consensus.hh.

Referenced by _setConfiguration().

vector<Normalizer*> ConsensusAlgorithm::_norms
protected

Definition at line 80 of file consensus.hh.

Referenced by _setAlgorithm(), _setConfiguration(), getValue(), iterate(), and ~ConsensusAlgorithm().

int ConsensusAlgorithm::_num_algs
protected
Scalar ConsensusAlgorithm::_sum_weights
protected

Definition at line 71 of file consensus.hh.

Referenced by _setConfiguration(), getValue(), and initialize().

Sample ConsensusAlgorithm::_thresholds
protected

Definition at line 72 of file consensus.hh.

Referenced by _getConfiguration(), _setConfiguration(), getValue(), initialize(), and iterate().

Sample ConsensusAlgorithm::_weights
protected

Definition at line 70 of file consensus.hh.

Referenced by _setConfiguration(), getValue(), and initialize().


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