Belle II Software  release-05-01-25
GRLMLP.h
1 #ifndef GRLMLP_H
2 #define GRLMLP_H
3 
4 #include <TObject.h>
5 #include <framework/logging/Logger.h>
6 
7 namespace Belle2 {
13  class GRLMLP : public TObject {
14 
15  // weights etc. are set only by the trainer
16  friend class GRLNeuroTrainerModule;
17 
18  public:
20  GRLMLP();
21 
23  GRLMLP(std::vector<unsigned short>& nodes, unsigned short targets, const std::vector<float>& outputscale);
24 
26  ~GRLMLP() { }
27 
29  bool isTrained() const { return trained; }
31  unsigned nLayers() const { return nNodes.size(); }
33  unsigned nNodesLayer(unsigned iLayer) const { return nNodes[iLayer]; }
35  unsigned nWeights() const { return weights.size(); }
37  unsigned nWeightsCal() const;
39  std::vector<float> getWeights() const { return weights; }
40 
41  private:
43  std::vector<unsigned short> nNodes;
45  std::vector<float> weights;
48  bool trained;
49 
51  unsigned short targetVars;
54  std::vector<float> outputScale;
55 
57  ClassDef(GRLMLP, 2);
58  };
60 }
61 #endif
Belle2::GRLNeuroTrainerModule
The trainer module for the neural networks of the CDC trigger.
Definition: GRLNeuroTrainerModule.h:21
Belle2::GRLMLP::nWeights
unsigned nWeights() const
get number of weights from length of weights vector
Definition: GRLMLP.h:35
Belle2::GRLMLP::weights
std::vector< float > weights
Weights of the network.
Definition: GRLMLP.h:45
Belle2::GRLMLP::nNodes
std::vector< unsigned short > nNodes
Number of nodes in each layer, not including bias nodes.
Definition: GRLMLP.h:43
Belle2::GRLMLP::~GRLMLP
~GRLMLP()
destructor, empty because we don't allocate memory anywhere.
Definition: GRLMLP.h:26
Belle2::GRLMLP
Class to keep all parameters of an expert MLP for the neuro trigger.
Definition: GRLMLP.h:13
Belle2::GRLMLP::trained
bool trained
Indicator whether the weights are just default values or have been set by some trainer (set to true w...
Definition: GRLMLP.h:48
Belle2::GRLMLP::GRLMLP
GRLMLP()
default constructor.
Definition: GRLMLP.cc:6
Belle2::GRLMLP::isTrained
bool isTrained() const
check if weights are default values or set by some trainer
Definition: GRLMLP.h:29
Belle2::GRLMLP::ClassDef
ClassDef(GRLMLP, 2)
Needed to make the ROOT object storable.
Belle2::GRLMLP::outputScale
std::vector< float > outputScale
Output[i] of the MLP is scaled from [-1, 1] to [outputScale[2i], outputScale[2i+1]].
Definition: GRLMLP.h:54
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::GRLMLP::nLayers
unsigned nLayers() const
get number of layers
Definition: GRLMLP.h:31
Belle2::GRLMLP::nNodesLayer
unsigned nNodesLayer(unsigned iLayer) const
get number of nodes in a layer
Definition: GRLMLP.h:33
Belle2::GRLMLP::getWeights
std::vector< float > getWeights() const
get weights vector
Definition: GRLMLP.h:39
Belle2::GRLMLP::nWeightsCal
unsigned nWeightsCal() const
calculate number of weights from number of nodes
Definition: GRLMLP.cc:22
Belle2::GRLMLP::targetVars
unsigned short targetVars
output variables: 1: z, 2: theta, 3: (z, theta)
Definition: GRLMLP.h:51