openModeller
Version 1.4.0
|
#include <consensus.hh>
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 |
Protected Member Functions | |
void | _getConfiguration (ConfigurationPtr &) const |
void | _setConfiguration (const ConstConfigurationPtr &) |
bool | _setAlgorithm (std::string alg_str) |
Protected Attributes | |
bool | _done |
bool | _initialized |
Sample | _weights |
Scalar | _sum_weights |
Sample | _thresholds |
vector< AlgorithmPtr > | _algs |
int | _num_algs |
int | _agreement |
vector< Normalizer * > | _norms |
Declaration of Consensus algorithm class.
LICENSE INFORMATION
Copyright(c) 2011 by CRIA - Centro de Referencia em Informacao Ambiental
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.
Definition at line 193 of file consensus.cpp.
Definition at line 206 of file consensus.cpp.
void ConsensusAlgorithm::_getConfiguration | ( | ConfigurationPtr & | config | ) | const [protected, virtual] |
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().
void ConsensusAlgorithm::_setConfiguration | ( | const ConstConfigurationPtr & | config | ) | [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 569 of file consensus.cpp.
References _agreement, _algs, _done, _initialized, _norms, _num_algs, _sum_weights, _thresholds, _weights, CONSENSUS_LOG_PREFIX, Log::error(), AlgorithmImpl::getParameter(), Log::instance(), MAX_ALGORITHMS, AlgorithmFactory::newAlgorithm(), and Sample::resize().
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.
Scalar ConsensusAlgorithm::getValue | ( | const Sample & | x | ) | const [virtual] |
The algorithm must return the occurrence probability at the given environment conditions.
x | Environmental conditions. |
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] |
Initiate a new training.
Implements AlgorithmImpl.
Definition at line 227 of file consensus.cpp.
References _agreement, _algs, _num_algs, AlgorithmImpl::_samp, _setAlgorithm(), _sum_weights, _thresholds, _weights, cloneSampler(), CONSENSUS_LOG_PREFIX, Log::error(), AlgorithmImpl::getNormalizer(), AlgorithmImpl::getParameter(), Log::instance(), MAX_ALGORITHMS, needNormalization(), and Sample::resize().
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().
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().
int ConsensusAlgorithm::_agreement [protected] |
Definition at line 78 of file consensus.hh.
Referenced by _setConfiguration(), getValue(), and initialize().
vector<AlgorithmPtr> ConsensusAlgorithm::_algs [protected] |
Definition at line 74 of file consensus.hh.
Referenced by _getConfiguration(), _setAlgorithm(), _setConfiguration(), getProgress(), getValue(), initialize(), iterate(), and ~ConsensusAlgorithm().
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] |
Definition at line 76 of file consensus.hh.
Referenced by _getConfiguration(), _setConfiguration(), getProgress(), getValue(), initialize(), and iterate().
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().