LCFIVertex  0.7.2
NeuronLayer.h
1 #ifndef NEURONLAYER_H
2 #define NEURONLAYER_H
3 
4 #include "NeuralNetConfig.h"
5 
6 #include <vector>
7 #include <string>
8 #include <iostream>
9 
10 #ifdef __CINT__
11 #include "Neuron.h"
12 #include "NeuronBuilder.h"
13 #include "NeuralNet.h"
14 #else
15 //namespace nnet added 15/08/06 by Mark Grimes (mark.grimes@bristol.ac.uk) for the LCFI vertex package
16 namespace nnet
17 {
18 class Neuron;
19 class NeuronBuilder;
20 class NeuralNet;
21 }
22 #endif
23 
24 // NeuronLayer is a simple container for Neurons.
25 // It can only be created on the heap, i.e. you have to new it.
26 
27 //namespace nnet added 15/08/06 by Mark Grimes (mark.grimes@bristol.ac.uk) for the LCFI vertex package
28 namespace nnet
29 {
30 
31 class
32 #ifndef __CINT__
33 NEURALNETDLL
34 #endif
36 {
37 public:
38  NeuronLayer(const NeuralNet *parentNetwork=0);
39  NeuronLayer(const int numberOfNeurons,const int numberOfInputsPerNeuron,const NeuronBuilder &theNeuronBuilder,const NeuralNet *parentNetwork=0);
40  NeuronLayer(const int numberOfInputsPerNeuron,const std::vector<std::string> &namedNeurons,const NeuralNet *parentNetwork=0);
41  NeuronLayer(const NeuronLayer &other,const NeuralNet *newParent);
42  void destroy() const;
43  void serialise(std::ostream &os) const;
44  int numberOfNeurons() const {return (int)_theNeurons.size();}
45  std::vector<double> output(const std::vector<double> &inputValues) const;
46  Neuron *neuron(const int i);
47  int numberOfWeights() const;
48  void setWeights(const std::vector<double> &newWeights);
49  std::vector<double> weights() const;
50  std::vector<double> derivativeOutput(const std::vector<double> &inputValues) const;
51  void addNeuron(Neuron *neuronToAdd);
52 
53 protected:
54  ~NeuronLayer(void);
55  void clear();
56 
57 private:
58  std::vector<Neuron *> _theNeurons;
59  const NeuralNet *_parentNetwork;
60 
61  NeuronLayer(const NeuronLayer &other); // Declared but not defined
62 
63 };
64 
65 }//namespace nnet
66 
67 #endif