openModeller  Version 1.5.0
NNAlgorithm Class Reference

#include <nn_alg.hh>

Inheritance diagram for NNAlgorithm:
Inheritance graph
Collaboration diagram for NNAlgorithm:
Collaboration graph

Public Member Functions

 NNAlgorithm ()
 
 ~NNAlgorithm ()
 
int needNormalization ()
 
int initialize ()
 
int iterate ()
 
float getProgress () const
 
int done () const
 
Scalar getValue (const Sample &x) 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 ()
 
virtual int getConvergence (Scalar *const val) const
 
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

virtual void _getConfiguration (ConfigurationPtr &) const
 
virtual void _setConfiguration (const ConstConfigurationPtr &)
 
- 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
 
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
 
- 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 Neural Network algorithm class.

Author
Fabrício Augusto Rodrigues (fabricio.rodrigues [at] poli . usp .br)
Alex Oshika Avilla (alex.avilla [at] poli . usp .br)
Id:
nn_alg.hh 5844 2013-08-22 15:16:12Z rdg

LICENSE INFORMATION

Copyright(c) 2007 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

Definition at line 43 of file nn_alg.hh.

Constructor & Destructor Documentation

NNAlgorithm::NNAlgorithm ( )

Definition at line 210 of file nn_alg.cpp.

References AlgorithmImpl::_normalizerPtr.

NNAlgorithm::~NNAlgorithm ( )

Definition at line 222 of file nn_alg.cpp.

Member Function Documentation

void NNAlgorithm::_getConfiguration ( ConfigurationPtr config) const
protectedvirtual

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.

Here is the call graph for this function:

void NNAlgorithm::_setConfiguration ( const ConstConfigurationPtr config)
protectedvirtual

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().

Here is the call graph for this function:

int NNAlgorithm::done ( ) const
virtual

Use this method to find out if the model has completed (e.g. convergence point has been met.

Note
This method is inherited from the Algorithm class
Returns
Implementation specific but usually 1 for completion.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Scalar NNAlgorithm::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.

This method is used when projecting the model.

Note
This method is inherited from the Algorithm class
Returns
Parameters
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().

Here is the call graph for this function:

int NNAlgorithm::iterate ( )
virtual

Start model execution (build the model).

Note
This method is inherited from the Algorithm class
Returns
0 on error

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().

Here is the call graph for this function:

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.

Member Data Documentation

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

Definition at line 125 of file nn_alg.hh.

Referenced by iterate().

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

Definition at line 119 of file nn_alg.hh.

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().


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