Belle II Software
release-05-01-25
GRLMLP.cc
1
#include <trg/grl/dataobjects/GRLMLP.h>
2
#include <cmath>
3
4
using namespace
Belle2
;
5
6
GRLMLP::GRLMLP
():
7
nNodes{23, 23, 1}, trained(
false
), targetVars(1), outputScale{ -1., 1.}
8
{
9
weights.assign(nWeightsCal(), 0.);
10
}
11
12
GRLMLP::GRLMLP
(std::vector<unsigned short>& nodes,
13
unsigned
short
targets,
14
const
std::vector<float>& outputscale
15
):
16
nNodes(nodes), trained(false), targetVars(targets), outputScale(outputscale)
17
{
18
weights
.assign(
nWeightsCal
(), 0.);
19
}
20
21
unsigned
22
GRLMLP::nWeightsCal
()
const
23
{
24
unsigned
nWeights
= 0;
25
if
(
nLayers
() > 1) {
26
nWeights
= (
nNodes
[0] + 1) *
nNodes
[1];
27
for
(
unsigned
il = 1; il <
nLayers
() - 1; ++il) {
28
nWeights
+= (
nNodes
[il] + 1) *
nNodes
[il + 1];
29
}
30
}
31
return
nWeights
;
32
}
33
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()
default constructor.
Definition:
GRLMLP.cc:6
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::nWeightsCal
unsigned nWeightsCal() const
calculate number of weights from number of nodes
Definition:
GRLMLP.cc:22
trg
grl
dataobjects
src
GRLMLP.cc
Generated on Fri Nov 5 2021 04:05:58 for Belle II Software by
1.8.17