openModeller
Version 1.4.0
|
#include <rf_alg.hh>
Public Member Functions | |
RfAlgorithm () | |
~RfAlgorithm () | |
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 | _sampleToLine (Sample sample, stringstream &ss) const |
void | _getConfiguration (ConfigurationPtr &) const |
void | _setConfiguration (const ConstConfigurationPtr &) |
Protected Attributes | |
bool | _done |
int | _num_trees |
int | _k |
bool | _initialized |
Random | _rand |
librf::InstanceSet * | _set |
vector< int > | _class_weights |
vector< librf::Tree * > | _trees |
Declaration of RF algorithm class.
LICENSE INFORMATION
Copyright(c) 2010 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 using Random Forests.
Definition at line 153 of file rf_alg.cpp.
Definition at line 164 of file rf_alg.cpp.
References _initialized, _set, and _trees.
void RfAlgorithm::_getConfiguration | ( | ConfigurationPtr & | config | ) | const [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 416 of file rf_alg.cpp.
References _done, _k, _num_trees, and _trees.
void RfAlgorithm::_sampleToLine | ( | Sample | sample, |
stringstream & | ss | ||
) | const [protected] |
Definition at line 311 of file rf_alg.cpp.
References Sample::size().
Referenced by getValue(), and initialize().
void RfAlgorithm::_setConfiguration | ( | const ConstConfigurationPtr & | config | ) | [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 480 of file rf_alg.cpp.
References _done, _initialized, _k, _num_trees, and _trees.
int RfAlgorithm::done | ( | ) | const [virtual] |
Return != 0 if algorithm finished.
Reimplemented from AlgorithmImpl.
Definition at line 367 of file rf_alg.cpp.
References _done.
Referenced by getProgress().
int RfAlgorithm::getConvergence | ( | Scalar *const | val | ) | const [virtual] |
Returns the algorithm's convergence value at the moment
Reimplemented from AlgorithmImpl.
Definition at line 407 of file rf_alg.cpp.
float RfAlgorithm::getProgress | ( | ) | const [virtual] |
Returns progress so far (between 0.0 and 1.0)
Reimplemented from AlgorithmImpl.
Definition at line 353 of file rf_alg.cpp.
References _num_trees, _trees, and done().
Scalar RfAlgorithm::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 375 of file rf_alg.cpp.
References _sampleToLine(), and _trees.
int RfAlgorithm::initialize | ( | ) | [virtual] |
Initiate a new training.
Implements AlgorithmImpl.
Definition at line 187 of file rf_alg.cpp.
References _class_weights, _initialized, _k, _num_trees, _rand, AlgorithmImpl::_samp, _sampleToLine(), _set, _trees, Log::error(), Random::get(), AlgorithmImpl::getParameter(), Log::instance(), K_ID, NUMTREES_ID, RF_LOG_PREFIX, UNSUP_ID, and Log::warn().
int RfAlgorithm::iterate | ( | ) | [virtual] |
One step further on the training. Return 0 if something wrong happened.
Reimplemented from AlgorithmImpl.
Definition at line 325 of file rf_alg.cpp.
References _class_weights, _done, _k, _num_trees, _rand, _set, _trees, and Random::get().
int RfAlgorithm::needNormalization | ( | ) | [virtual] |
The algorithm should return != 0 if it needs normalization of environmental variables (non categorical ones).
Reimplemented from AlgorithmImpl.
Definition at line 179 of file rf_alg.cpp.
vector<int> RfAlgorithm::_class_weights [protected] |
Definition at line 81 of file rf_alg.hh.
Referenced by initialize(), and iterate().
bool RfAlgorithm::_done [protected] |
Definition at line 69 of file rf_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), done(), and iterate().
bool RfAlgorithm::_initialized [protected] |
Definition at line 75 of file rf_alg.hh.
Referenced by _setConfiguration(), initialize(), and ~RfAlgorithm().
int RfAlgorithm::_k [protected] |
Definition at line 73 of file rf_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), initialize(), and iterate().
int RfAlgorithm::_num_trees [protected] |
Definition at line 71 of file rf_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), getProgress(), initialize(), and iterate().
Random RfAlgorithm::_rand [protected] |
Definition at line 77 of file rf_alg.hh.
Referenced by initialize(), and iterate().
librf::InstanceSet* RfAlgorithm::_set [protected] |
Definition at line 79 of file rf_alg.hh.
Referenced by initialize(), iterate(), and ~RfAlgorithm().
vector<librf::Tree*> RfAlgorithm::_trees [protected] |
Definition at line 83 of file rf_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), getProgress(), getValue(), initialize(), iterate(), and ~RfAlgorithm().