LoveBrains  1.0.0
ann_layer.h
1 /*
2 ** ann_layer.h for GANNEngine in /home/robin_f/Programming/Git/CPP/GANNEngine
3 **
4 ** Made by Guillaume ROBIN
5 ** Login <robin_f@epitech.eu>
6 **
7 ** Started on Wed Jul 8 14:16:10 2015 Guillaume ROBIN
8 ** Last update Fri Aug 21 23:34:14 2015 Guillaume ROBIN
9 */
10 
11 #ifndef ANN_LAYER_H_
12 # define ANN_LAYER_H_
13 
14 # include "ANN/matrix.h"
15 
16 namespace GANN
17 {
22  class ANNLayer
23  {
24  public:
25  /*
26  ** Typedef.
27  */
31  typedef double (*FActivate)(double);
32 
41  ANNLayer(unsigned int num_inputs, unsigned int num_neurons,
42  double min, double max, FActivate activation);
47  ANNLayer(ANNLayer const& copy);
51  ANNLayer(void);
55  ~ANNLayer(void);
56 
57  /*
58  ** Getters.
59  */
60 
65  Matrix<double> const& getWeights(void) const;
75  Matrix<double> const& getOutputs(void) const;
80  Matrix<double> const& getBias(void) const;
85  Matrix<double>& getBias(void);
90  FActivate getActivationFunction(void) const;
91 
92  /*
93  ** Setters.
94  */
95 
100  void setWeights(Matrix<double> const& weights);
105  void setBias(Matrix<double> const& bias);
110  void setOutputs(Matrix<double> const& outputs);
116 
117  /*
118  ** Overlaod.
119  */
120  ANNLayer& operator=(ANNLayer const& layer);
121 
122  /*
123  ** Methods.
124  */
125 
130  void Activate(Matrix<double> const& inputs);
131 
132  private:
133  Matrix<double> _weights;
134  Matrix<double> _outputs;
135  Matrix<double> _bias;
136  FActivate _activate;
137  };
138 }
139 
140 #endif /* !ANN_LAYER_H_ */
~ANNLayer(void)
Destructor.
Definition: ann_layer.cc:51
void setOutputs(Matrix< double > const &outputs)
Set the outputs matrix.
Definition: ann_layer.cc:101
void Activate(Matrix< double > const &inputs)
Activate the current layer and set the matrix of outputs.
Definition: ann_layer.cc:125
Matrix< double > const & getBias(void) const
Get the bias matrix of the neural network.
Definition: ann_layer.cc:73
Define a layer of a neural network.
Definition: ann_layer.h:22
void setBias(Matrix< double > const &bias)
Set the matrix of bias.
Definition: ann_layer.cc:96
double(* FActivate)(double)
Function pointer of an activation function.
Definition: ann_layer.h:31
Contains all the objects that provide the management for the genetic algorithm with neural networks...
Definition: ann_exception.h:16
void setActivationFunction(FActivate f)
Set the activation function of the layer.
Definition: ann_layer.cc:106
ANNLayer(void)
Constructor.
Definition: ann_layer.cc:24
FActivate getActivationFunction(void) const
Get the activation function of the current layer.
Definition: ann_layer.cc:83
Matrix< double > const & getOutputs(void) const
Get the outputs matrix of the neural network. GANN::Matrix const&.
Definition: ann_layer.cc:68
Matrix< double > const & getWeights(void) const
Get the weights matrix of the neural network.
Definition: ann_layer.cc:58
void setWeights(Matrix< double > const &weights)
Set the matrix of weights.
Definition: ann_layer.cc:91