openModeller
Version 1.4.0
|
#include <nn_alg.hh>
Public Member Functions | |
NNAlgorithm () | |
~NNAlgorithm () | |
int | needNormalization () |
int | initialize () |
int | iterate () |
float | getProgress () const |
int | done () const |
Scalar | getValue (const Sample &x) const |
Protected Member Functions | |
virtual void | _getConfiguration (ConfigurationPtr &) const |
virtual void | _setConfiguration (const ConstConfigurationPtr &) |
Protected Attributes | |
bool | _done |
int | _num_layers |
int | num_presences |
int | num_absences |
Network | network |
vector< vector< double > > | vector_input |
vector< vector< double > > | vector_output |
nn_parameter | _nn_parameter |
double * | outputs |
unsigned long | amount_epoch |
float | _progress |
int | converged |
OccurrencesPtr | absences |
OccurrencesPtr | presences |
Declaration of Neural Network algorithm class.
LICENSE INFORMATION
Copyright(c) 2007 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:
Definition at line 210 of file nn_alg.cpp.
References AlgorithmImpl::_normalizerPtr.
Definition at line 222 of file nn_alg.cpp.
void NNAlgorithm::_getConfiguration | ( | ConfigurationPtr & | config | ) | const [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 622 of file nn_alg.cpp.
References _done, _nn_parameter, _num_layers, Network::getBias(), Network::getWeight(), nn_parameter::hid, and network.
void NNAlgorithm::_setConfiguration | ( | const ConstConfigurationPtr & | config | ) | [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 713 of file nn_alg.cpp.
References _done, _nn_parameter, _num_layers, nn_parameter::hid, nn_parameter::learning_rate, network, Network::RandomizeWB(), Network::setBias(), Network::SetData(), and Network::setWeight().
int NNAlgorithm::done | ( | ) | const [virtual] |
Use this method to find out if the model has completed (e.g. convergence point has been met.
Reimplemented from AlgorithmImpl.
Definition at line 579 of file nn_alg.cpp.
References _done, Log::debug(), Log::instance(), and NN_LOG_PREFIX.
Referenced by getProgress().
float NNAlgorithm::getProgress | ( | ) | const [virtual] |
Return progress so far
Reimplemented from AlgorithmImpl.
Definition at line 560 of file nn_alg.cpp.
References _progress, and done().
Scalar NNAlgorithm::getValue | ( | const Sample & | x | ) | const [virtual] |
This method is used when projecting the model.
x | Pointer 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. |
This method is used when projecting the model.
Scalar | *x a pointer 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 597 of file nn_alg.cpp.
References _num_layers, Network::GetOutput(), network, and Network::SetInputs().
int NNAlgorithm::initialize | ( | ) | [virtual] |
Initialise the model specifying a threshold / cutoff point. This is optional (model dependent).
Implements AlgorithmImpl.
Definition at line 252 of file nn_alg.cpp.
References _nn_parameter, AlgorithmImpl::_normalizerPtr, _num_layers, AlgorithmImpl::_samp, absences, amount_epoch, nn_parameter::choice, CHOICE_ID, Normalizer::computeNormalization(), createSampler(), Log::debug(), nn_parameter::epoch, EPOCH_ID, Log::error(), AlgorithmImpl::getParameter(), nn_parameter::hid, HIDDEN_ID, nn_parameter::inp, Log::instance(), nn_parameter::learning_rate, LEARNING_RATE_ID, MIN_ERROR_ID, nn_parameter::minimum_error, nn_parameter::momentum, MOMENTUM_ID, network, NN_LOG_PREFIX, num_absences, num_presences, nn_parameter::outp, nn_parameter::pattern, presences, Network::RandomizeWB(), Network::SetData(), AlgorithmImpl::setNormalization(), vector_input, vector_output, and Log::warn().
int NNAlgorithm::iterate | ( | ) | [virtual] |
Start model execution (build the model).
Reimplemented from AlgorithmImpl.
Definition at line 498 of file nn_alg.cpp.
References _done, _nn_parameter, _progress, amount_epoch, nn_parameter::choice, converged, nn_parameter::epoch, Network::getProgress(), Log::info(), Log::instance(), nn_parameter::minimum_error, nn_parameter::momentum, network, NN_LOG_PREFIX, nn_parameter::pattern, Network::Train(), Network::trainingEpoch(), Network::trainingMinimumError(), vector_input, vector_output, and Log::warn().
int NNAlgorithm::needNormalization | ( | ) | [virtual] |
The algorithm should return != 0 if it needs normalization of environmental variables (non categorical ones).
Reimplemented from AlgorithmImpl.
Definition at line 229 of file nn_alg.cpp.
References AlgorithmImpl::_samp.
bool NNAlgorithm::_done [protected] |
Definition at line 100 of file nn_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), done(), and iterate().
nn_parameter NNAlgorithm::_nn_parameter [protected] |
Definition at line 117 of file nn_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), initialize(), and iterate().
int NNAlgorithm::_num_layers [protected] |
Definition at line 102 of file nn_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), getValue(), and initialize().
float NNAlgorithm::_progress [protected] |
Definition at line 123 of file nn_alg.hh.
Referenced by getProgress(), and iterate().
OccurrencesPtr NNAlgorithm::absences [protected] |
Definition at line 130 of file nn_alg.hh.
Referenced by initialize().
unsigned long NNAlgorithm::amount_epoch [protected] |
Definition at line 121 of file nn_alg.hh.
Referenced by initialize(), and iterate().
int NNAlgorithm::converged [protected] |
Network NNAlgorithm::network [protected] |
Definition at line 111 of file nn_alg.hh.
Referenced by _getConfiguration(), _setConfiguration(), getValue(), initialize(), and iterate().
int NNAlgorithm::num_absences [protected] |
Definition at line 106 of file nn_alg.hh.
Referenced by initialize().
int NNAlgorithm::num_presences [protected] |
Definition at line 104 of file nn_alg.hh.
Referenced by initialize().
double* NNAlgorithm::outputs [protected] |
OccurrencesPtr NNAlgorithm::presences [protected] |
Definition at line 132 of file nn_alg.hh.
Referenced by initialize().
vector<vector<double> > NNAlgorithm::vector_input [protected] |
Definition at line 113 of file nn_alg.hh.
Referenced by initialize(), and iterate().
vector<vector<double> > NNAlgorithm::vector_output [protected] |
Definition at line 115 of file nn_alg.hh.
Referenced by initialize(), and iterate().