openModeller  Version 1.4.0
nn_alg.hh
Go to the documentation of this file.
00001 
00028 #ifndef _NN_ALGHH_
00029 #define _NN_ALGHH_
00030 
00031 #include <vector>
00032 
00033 #include <openmodeller/om.hh>
00034 
00035 #include "nn.h"
00036 
00037 /**************************************************/
00038 /****************** Neural Network ****************/
00039 
00040 /* 
00041  * Algorithm to generate models using Neural Network.
00042  */
00043 class NNAlgorithm : public AlgorithmImpl
00044 {
00045 
00046 public:
00047 
00048   NNAlgorithm();
00049 
00050   ~NNAlgorithm();
00051 
00052   int needNormalization();
00053 
00059   int initialize();
00060 
00065   int iterate();
00066 
00069   float getProgress() const;
00070 
00077   int done() const;
00078 
00079 
00080   //
00081   // Methods used to project the model
00082   //
00083     
00089   Scalar getValue( const Sample& x ) const;
00090   
00091 
00092  
00093 protected:
00094 
00095   virtual void _getConfiguration( ConfigurationPtr& ) const;
00096 
00097   virtual void _setConfiguration( const ConstConfigurationPtr& );
00098 
00099 
00100   bool _done;
00101 
00102   int _num_layers;
00103 
00104   int num_presences;
00105 
00106   int num_absences;
00107 
00108 
00109   // Algorithm's variables
00110   
00111   Network network;
00112 
00113   vector<vector<double> > vector_input; // [num_patterns][_num_layers]
00114 
00115   vector<vector<double> > vector_output;// [num_pattern][_nn_parameter.outp]
00116 
00117   nn_parameter _nn_parameter;
00118 
00119   double *outputs;
00120 
00121   unsigned long amount_epoch; // Number of epoch in training
00122 
00123   float _progress; // Percent of training
00124 
00125   int converged; // Used to verify if the training by minimum error converged
00126 
00127 
00128   // Work with occurrences 
00129 
00130   OccurrencesPtr absences;
00131 
00132   OccurrencesPtr presences;
00133 };
00134 
00135 
00136 #endif