openModeller  Version 1.5.0
nn_alg.hh
Go to the documentation of this file.
1 
28 #ifndef _NN_ALGHH_
29 #define _NN_ALGHH_
30 
31 #include <vector>
32 
33 #include <openmodeller/om.hh>
34 
35 #include "nn.h"
36 
37 /**************************************************/
38 /****************** Neural Network ****************/
39 
40 /*
41  * Algorithm to generate models using Neural Network.
42  */
43 class NNAlgorithm : public AlgorithmImpl
44 {
45 
46 public:
47 
48  NNAlgorithm();
49 
50  ~NNAlgorithm();
51 
52  int needNormalization();
53 
59  int initialize();
60 
65  int iterate();
66 
69  float getProgress() const;
70 
77  int done() const;
78 
79 
80  //
81  // Methods used to project the model
82  //
83 
89  Scalar getValue( const Sample& x ) const;
90 
91 
92 
93 protected:
94 
95  virtual void _getConfiguration( ConfigurationPtr& ) const;
96 
97  virtual void _setConfiguration( const ConstConfigurationPtr& );
98 
99 
100  bool _done;
101 
103 
105 
107 
108 
109  // Algorithm's variables
110 
112 
113  vector<vector<double> > vector_input; // [num_patterns][_num_layers]
114 
115  vector<vector<double> > vector_output;// [num_pattern][_nn_parameter.outp]
116 
118 
119  double *outputs;
120 
121  unsigned long amount_epoch; // Number of epoch in training
122 
123  float _progress; // Percent of training
124 
125  int converged; // Used to verify if the training by minimum error converged
126 
127 
128  // Work with occurrences
129 
131 
133 };
134 
135 
136 #endif
Scalar getValue(const Sample &x) const
Definition: nn_alg.cpp:597
float _progress
Definition: nn_alg.hh:123
bool _done
Definition: nn_alg.hh:100
int initialize()
Definition: nn_alg.cpp:252
double Scalar
Type of map values.
Definition: om_defs.hh:39
unsigned long amount_epoch
Definition: nn_alg.hh:121
nn_parameter _nn_parameter
Definition: nn_alg.hh:117
int converged
Definition: nn_alg.hh:125
int iterate()
Definition: nn_alg.cpp:498
int num_absences
Definition: nn_alg.hh:106
OccurrencesPtr presences
Definition: nn_alg.hh:132
Definition: nn.h:151
int done() const
Definition: nn_alg.cpp:579
~NNAlgorithm()
Definition: nn_alg.cpp:222
float getProgress() const
Definition: nn_alg.cpp:560
vector< vector< double > > vector_input
Definition: nn_alg.hh:113
int _num_layers
Definition: nn_alg.hh:102
int num_presences
Definition: nn_alg.hh:104
vector< vector< double > > vector_output
Definition: nn_alg.hh:115
virtual void _getConfiguration(ConfigurationPtr &) const
Definition: nn_alg.cpp:622
virtual void _setConfiguration(const ConstConfigurationPtr &)
Definition: nn_alg.cpp:713
double * outputs
Definition: nn_alg.hh:119
OccurrencesPtr absences
Definition: nn_alg.hh:130
Network network
Definition: nn_alg.hh:111
int needNormalization()
Definition: nn_alg.cpp:229
Definition: Sample.hh:25