ATLAS Offline Software
Loading...
Searching...
No Matches
TTrainedNetwork Class Reference

#include <TTrainedNetwork.h>

Inheritance diagram for TTrainedNetwork:
Collaboration diagram for TTrainedNetwork:

Classes

struct  Input

Public Types

enum  ActivationFunction { SIGMOID = 1 }
typedef std::vector< Double_t > DVec
typedef std::map< std::string, double > DMap
typedef DMap::const_iterator DMapI

Public Member Functions

 TTrainedNetwork ()
 TTrainedNetwork (Int_t nInput, Int_t nHidden, Int_t nOutput, std::vector< Int_t > &nHiddenLayerSize, std::vector< TVectorD * > &thresholdVectors, std::vector< TMatrixD * > &weightMatrices, Int_t activationFunction, bool linearOutput=false, bool normalizeOutput=false)
 ~TTrainedNetwork ()
void setNewWeights (std::vector< TVectorD * > &thresholdVectors, std::vector< TMatrixD * > &weightMatrices)
Int_t getnInput () const
Int_t getnHidden () const
Int_t getnOutput () const
const std::vector< Int_t > & getnHiddenLayerSize () const
Int_t getActivationFunction () const
const std::vector< TVectorD * > & getThresholdVectors () const
const std::vector< TMatrixD * > & weightMatrices () const
std::vector< Double_t > calculateOutputValues (std::vector< Double_t > &input) const
bool getIfLinearOutput () const
bool getIfNormalizeOutput () const
 TTrainedNetwork ()
 TTrainedNetwork (Int_t nInput, Int_t nHidden, Int_t nOutput, std::vector< Int_t > &nHiddenLayerSize, std::vector< TVectorD * > &thresholdVectors, std::vector< TMatrixD * > &weightMatrices, Int_t activationFunction, bool linearOutput=false, bool normalizeOutput=false)
void setOffsets (const std::vector< double > &offsets)
void setScales (const std::vector< double > &scales)
 TTrainedNetwork (const std::vector< TTrainedNetwork::Input > &inputs, unsigned nOutput, std::vector< TVectorD * > &thresholdVectors, std::vector< TMatrixD * > &weightMatrices, ActivationFunction activationFunction=SIGMOID, unsigned options=0)
 ~TTrainedNetwork ()
std::vector< InputgetInputs () const
void setNewWeights (std::vector< TVectorD * > &thresholdVectors, std::vector< TMatrixD * > &weightMatrices)
Int_t getnInput () const
Int_t getnHidden () const
Int_t getnOutput () const
const std::vector< Int_t > & getnHiddenLayerSize () const
Int_t getActivationFunction () const
const std::vector< TVectorD * > & getThresholdVectors () const
const std::vector< TMatrixD * > & weightMatrices () const
DVec calculateOutputValues (const DVec &input) const
DVec calculateNormalized (const DVec &input) const
DVec calculateNormalized (const DMap &input) const
bool getIfLinearOutput () const
bool getIfNormalizeOutput () const

Static Public Attributes

static const unsigned linearOutput = 1u << 0
static const unsigned normalizeOutput = 1u << 1

Private Member Functions

Double_t sigmoid (Double_t x) const
Double_t sigmoid (Double_t x) const
bool is_consistent () const
bool check_norm_size (unsigned size) const

Private Attributes

Int_t m_nInput
Int_t m_nHidden
Int_t m_nOutput
std::vector< Int_t > m_nHiddenLayerSize
std::vector< TVectorD * > m_ThresholdVectors
std::vector< TMatrixD * > m_WeightMatrices
Int_t m_ActivationFunction
 cache of the maximum needed size, not persisitified
bool m_LinearOutput
bool m_NormalizeOutput
unsigned m_nInput
unsigned m_nHidden
unsigned m_nOutput
std::vector< Double_t > m_input_node_offset
std::vector< Double_t > m_input_node_scale
std::map< std::string, int > m_inputStringToNode
unsigned int m_bufferSizeMax
double m_maxExpValue

Detailed Description

Member Typedef Documentation

◆ DMap

◆ DMapI

◆ DVec

Member Enumeration Documentation

◆ ActivationFunction

Constructor & Destructor Documentation

◆ TTrainedNetwork() [1/5]

◆ TTrainedNetwork() [2/5]

TTrainedNetwork::TTrainedNetwork ( Int_t nInput,
Int_t nHidden,
Int_t nOutput,
std::vector< Int_t > & nHiddenLayerSize,
std::vector< TVectorD * > & thresholdVectors,
std::vector< TMatrixD * > & weightMatrices,
Int_t activationFunction,
bool linearOutput = false,
bool normalizeOutput = false )

Definition at line 22 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx.

◆ ~TTrainedNetwork() [1/2]

TTrainedNetwork::~TTrainedNetwork ( )

Definition at line 43 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx.

44{
45 std::vector<TVectorD*>::const_iterator vectBegin=m_ThresholdVectors.begin();
46 std::vector<TVectorD*>::const_iterator vectEnd=m_ThresholdVectors.end();
47
48 for (std::vector<TVectorD*>::const_iterator vectIter=vectBegin;
49 vectIter!=vectEnd;
50 ++vectIter)
51 {
52 delete *vectIter;
53 }
54
55 std::vector<TMatrixD*>::const_iterator matrixBegin=m_WeightMatrices.begin();
56 std::vector<TMatrixD*>::const_iterator matrixEnd=m_WeightMatrices.end();
57
58 for (std::vector<TMatrixD*>::const_iterator matrixIter=matrixBegin;
59 matrixIter!=matrixEnd;
60 ++matrixIter)
61 {
62 delete *matrixIter;
63 }
64
65}

◆ TTrainedNetwork() [3/5]

TTrainedNetwork::TTrainedNetwork ( )

◆ TTrainedNetwork() [4/5]

TTrainedNetwork::TTrainedNetwork ( Int_t nInput,
Int_t nHidden,
Int_t nOutput,
std::vector< Int_t > & nHiddenLayerSize,
std::vector< TVectorD * > & thresholdVectors,
std::vector< TMatrixD * > & weightMatrices,
Int_t activationFunction,
bool linearOutput = false,
bool normalizeOutput = false )

◆ TTrainedNetwork() [5/5]

TTrainedNetwork::TTrainedNetwork ( const std::vector< TTrainedNetwork::Input > & inputs,
unsigned nOutput,
std::vector< TVectorD * > & thresholdVectors,
std::vector< TMatrixD * > & weightMatrices,
ActivationFunction activationFunction = SIGMOID,
unsigned options = 0 )

Definition at line 76 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

82{
83 m_nInput = inputs.size();
84 m_nHidden = thresholdVectors.size() - 1;
85 m_nOutput = nOutput;
86 m_ThresholdVectors = thresholdVectors;
88 m_ActivationFunction = activationFunction;
91 m_maxExpValue = log(std::numeric_limits<double>::max());
92
93 std::vector<TVectorD*>::const_iterator hidden_layer_threshold_vector_end =
94 m_ThresholdVectors.end();
95 --hidden_layer_threshold_vector_end;
96
97 for (std::vector<TVectorD*>::const_iterator tr_itr
98 = m_ThresholdVectors.begin();
99 tr_itr != hidden_layer_threshold_vector_end;
100 ++tr_itr){
101 m_nHiddenLayerSize.push_back((*tr_itr)->GetNrows());
102 }
103
104 unsigned node_n = 0;
105 for (const auto & input : inputs) {
106 m_input_node_offset.push_back(input.offset);
107 m_input_node_scale.push_back(input.scale);
108 if (!input.name.empty()) {
109 m_inputStringToNode[input.name] = node_n;
110 }
111 node_n++;
112 }
113
114 unsigned n_node = node_n;
115 assert(n_node == m_input_node_offset.size());
116 assert(n_node == m_input_node_scale.size());
117
118 // mapping should either be unique or non-existent
119 unsigned n_mapped = m_inputStringToNode.size();
120 if (n_node != n_mapped && n_mapped != 0) {
121 throw std::runtime_error("Names for NN inputs must be unique (if given)");
122 }
123
124 int nlayer_max(m_nOutput);
125 for (int & i : m_nHiddenLayerSize)
126 nlayer_max = std::max(nlayer_max, i);
127 m_bufferSizeMax=nlayer_max;
128
129 unsigned n_zero = std::count(m_input_node_scale.begin(),
130 m_input_node_scale.end(), 0);
131 if (n_zero == n_node) {
132 m_input_node_scale.clear();
133 m_input_node_offset.clear();
134 }
135
136 assert(is_consistent());
137}

◆ ~TTrainedNetwork() [2/2]

TTrainedNetwork::~TTrainedNetwork ( )

Member Function Documentation

◆ calculateNormalized() [1/2]

std::vector< Double_t > TTrainedNetwork::calculateNormalized ( const DMap & input) const

Definition at line 225 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

226 {
227
228 std::vector<Double_t> inputs(m_nInput);
229 size_t n_filled = 0;
230 for (const auto & itr : in){
231 std::map<std::string,int>::const_iterator input_node_ptr =
232 m_inputStringToNode.find(itr.first);
233 if (input_node_ptr == m_inputStringToNode.end()) {
234 throw std::runtime_error(itr.first + "not found in NN");
235 }
236
237 const int node_n = input_node_ptr->second;
238
239 // get and scale the raw input value
240 double raw_value = itr.second;
241 raw_value += m_input_node_offset.at(node_n);
242 raw_value *= m_input_node_scale.at(node_n);
243
244 // store in the inputs vector
245 inputs.at(node_n) = raw_value;
246 n_filled++;
247 }
248
249 // make sure all nodes are filled
250 if (n_filled != m_inputStringToNode.size() ) {
251 assert(n_filled < m_inputStringToNode.size() );
252 std::set<std::string> input_set;
253 for (const auto & itr : in) {
254 input_set.insert(itr.first);
255 }
256 std::string err = "nodes not filled in NN: ";
257 for (const auto & itr : m_inputStringToNode){
258 if (input_set.find(itr.first) == input_set.end() )
259 err.append(itr.first + " ");
260 }
261 throw std::runtime_error(err);
262 }
263 return calculateOutputValues(inputs);
264}
std::vector< Double_t > calculateOutputValues(std::vector< Double_t > &input) const

◆ calculateNormalized() [2/2]

std::vector< Double_t > TTrainedNetwork::calculateNormalized ( const DVec & input) const

Definition at line 267 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

269{
270 // asserts can be turned off in optomized code anyway,
271 // use them to be safe without having to call vector.at()
272 assert(m_nInput == input.size());
273 assert(m_nInput == m_input_node_scale.size());
274 assert(m_nInput == m_input_node_offset.size());
275 std::vector<double> transformed_inputs(input);
276 for (unsigned input_n = 0; input_n < m_nInput; input_n++) {
277 transformed_inputs[input_n] += m_input_node_offset[input_n];
278 transformed_inputs[input_n] *= m_input_node_scale[input_n];
279 }
280 return calculateOutputValues(transformed_inputs);
281}

◆ calculateOutputValues() [1/2]

std::vector< Double_t > TTrainedNetwork::calculateOutputValues ( const DVec & input) const

Definition at line 283 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

285{
286 // This method is now highly optimised (apart from the potential use
287 // of a cheaper sigmoid function). Please be very careful changing
288 // anything here since it is used heavily in reconstruction during
289 // Pixel clusterization - Thomas Kittelmann, Oct 2011.
290
291
292 if (input.size() != m_nInput)
293 {
294 std::cerr << "TTrainedNetwork WARNING Input size: " << input.size()
295 << " does not match with network: " << m_nInput << std::endl;
296 return {};
297 }
298
299 TTN::DoubleBuffer_t tmp_array;
300 tmp_array.clear(m_bufferSizeMax); // make sure it is big enough and initialise with zero
301
302 const unsigned nTargetLayers(m_nHidden+1);
303 const unsigned lastTargetLayer(m_nHidden);
304 unsigned nSource = m_nInput, nTarget(0);
305 TTN::ConstBuffer_t source(input);
306 const double * weights(nullptr);
307 const double * thresholds(nullptr);
308 double nodeVal(0);
309
310 for (unsigned iLayer = 0; iLayer < nTargetLayers; ++iLayer) {
311 //Find data area for target layer:
312 nTarget = ( iLayer == lastTargetLayer ?
313 m_nOutput :
314 m_nHiddenLayerSize[iLayer] );
315 TTN::Buffer_t target( tmp_array[iLayer] );
316
317 //Transfer the input nodes to the output nodes in this layer transition:
318 weights = m_WeightMatrices[iLayer]->GetMatrixArray();
319 thresholds = m_ThresholdVectors[iLayer]->GetMatrixArray();
320 for (unsigned inodeTarget=0;inodeTarget<nTarget;++inodeTarget) {
321 nodeVal = 0.0;//Better would be "nodeVal = *thresholds++" and
322 //remove the line further down, but this way we
323 //get exactly the same results that an earlier
324 //version of the package gave.
325 const double * weights_tmp = weights++;
326 const double * source_end(&(source.upper_bound_at(nSource)));
327 for (const double* source_iter = &source[0];
328 source_iter != source_end; ++source_iter)
329 {
330 nodeVal += (*weights_tmp) * (*source_iter);
331 weights_tmp += nTarget;
332 }
333 nodeVal += *thresholds++;//see remark above.
334 target[inodeTarget] = ( m_LinearOutput && iLayer == lastTargetLayer )
335 ? nodeVal : sigmoid(nodeVal);
336 }
337 //Prepare for next layer transition:
338 source = target;
339 nSource = nTarget;
340 }
341
342 //std::vector<double> result(nTarget);
343 if (!m_NormalizeOutput) {
344 // std::memcpy(&result[0], target, sizeof(*target)*nTarget);
345 // the result is already in the buffer half with index (nTargetLayers-1)%2
346 // copy this to the front of the full buffer and shrink the array
347 return tmp_array.releaseData(nTarget,(nTargetLayers-1));
348 } else {
349 // take the other half buffer to store the normalised output
350 TTN::Buffer_t norm_target=tmp_array[nTargetLayers];
351 TTN::Buffer_t target=tmp_array[(nTargetLayers-1)];
352 const double sumLastLayer =
353 std::accumulate(&target[0], &target[nTarget], 0.0 );
354 const double normFact = (sumLastLayer!=0.) ? 1.0/sumLastLayer : 0.0;
355 for (unsigned i = 0; i < nTarget; ++i)
356 norm_target[i] = normFact * target[i];
357 // copy the half buffer to the front of the full buffer
358 // if necessary and shrink the array
359 return tmp_array.releaseData(nTarget,nTargetLayers);
360 }
361
362}
std::vector< double > releaseData(std::vector< double >::size_type final_size, unsigned int fold_idx)
move the final result to its destination
void clear(unsigned int max_buffer)

◆ calculateOutputValues() [2/2]

std::vector< Double_t > TTrainedNetwork::calculateOutputValues ( std::vector< Double_t > & input) const

Definition at line 99 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx.

100{
101
102 std::vector<Double_t> result;
103
104 //now calculate the value using:
105 TVectorD** resultVector=new TVectorD*[m_nHidden+1];
106
107
108 if ((int)input.size()!=m_nInput)
109 {
110 std::cout << " Input size: " << input.size() << " doesn't match with network: " << m_nInput << std::endl;
111 delete[] resultVector;
112 return result;
113 }
114
115 for (Int_t o=0;o<m_nHidden+1;++o)
116 {
117
118 int sizeActualLayer=(o<m_nHidden)?m_nHiddenLayerSize[o]:m_nOutput;
119// int sizePreviousLayer=(o==0)?m_nInput:m_nHiddenLayerSize[o-1];
120
121 resultVector[o]=new TVectorD(sizeActualLayer);
122
123 for (Int_t s=0;s<sizeActualLayer;++s)
124 {
125 Double_t nodeValue=0.;
126 if (o==0)
127 {
128 for (Int_t p=0;p<m_nInput;++p)
129 {
130 nodeValue+=m_WeightMatrices[o]->operator() (p,s)*input[p];
131 }
132 }
133 else
134 {
135 for (Int_t p=0;p<m_nHiddenLayerSize[o-1];++p)
136 {
137 nodeValue+=m_WeightMatrices[o]->operator() (p,s)*resultVector[o-1]->operator()(p);
138 }
139 }
140 nodeValue+=m_ThresholdVectors[o]->operator() (s);
141 if (o!=m_nHidden || (!m_LinearOutput))
142 {
143 resultVector[o]->operator()(s) = sigmoid(nodeValue);
144 }
145 else
146 {
147 resultVector[o]->operator()(s) = nodeValue;
148 }
149 }
150 }
151
152 double sumLastLayer=0;
153
155 {
156 for (Int_t i=0;i<m_nOutput;i++)
157 {
158 sumLastLayer+=resultVector[m_nHidden]->operator()(i);
159 }
160 }
161
162
163 for (Int_t i=0;i<m_nOutput;i++)
164 {
166 {
167 result.push_back(resultVector[m_nHidden]->operator()(i));
168 }
169 else
170 {
171 result.push_back(resultVector[m_nHidden]->operator()(i)/sumLastLayer);
172 }
173 }
174
175 for (Int_t o=0;o<m_nHidden+1;++o)
176 {
177 //int sizeActualLayer=(o<m_nHidden)?m_nHiddenLayerSize[o]:m_nOutput;
178 delete resultVector[o];
179 }
180 delete[] resultVector;
181
182 return result;
183
184}

◆ check_norm_size()

bool TTrainedNetwork::check_norm_size ( unsigned size) const
private

Definition at line 412 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

412 {
413 if (size != m_nInput) {
414 std::cerr << "ERROR: TTrainedNetwork has " << m_nInput << " inputs, "
415 << size << " normalization values provided\n";
416 return false;
417 }
418 return true;
419}

◆ getActivationFunction() [1/2]

Int_t TTrainedNetwork::getActivationFunction ( ) const
inline

◆ getActivationFunction() [2/2]

Int_t TTrainedNetwork::getActivationFunction ( ) const
inline

◆ getIfLinearOutput() [1/2]

bool TTrainedNetwork::getIfLinearOutput ( ) const
inline

◆ getIfLinearOutput() [2/2]

bool TTrainedNetwork::getIfLinearOutput ( ) const
inline

◆ getIfNormalizeOutput() [1/2]

bool TTrainedNetwork::getIfNormalizeOutput ( ) const
inline

◆ getIfNormalizeOutput() [2/2]

bool TTrainedNetwork::getIfNormalizeOutput ( ) const
inline

◆ getInputs()

std::vector< TTrainedNetwork::Input > TTrainedNetwork::getInputs ( ) const

Definition at line 163 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

163 {
164
165 assert(m_inputStringToNode.size() == 0 ||
166 m_inputStringToNode.size() == m_nInput);
167 assert(m_input_node_scale.size() == m_input_node_offset.size());
168
169 std::map<int,std::string> input_n_to_name;
170 for (const auto & itr : m_inputStringToNode){
171 input_n_to_name[itr.second] = itr.first;
172 }
173
174 std::vector<Input> inputs_vector;
175 if (m_input_node_offset.size() != m_nInput) {
176 return inputs_vector;
177 }
178 for (unsigned input_n = 0; input_n < m_nInput; input_n++){
179 std::map<int,std::string>::const_iterator
180 name_itr = input_n_to_name.find(input_n);
181 Input the_input;
182 if (name_itr != input_n_to_name.end()) {
183 the_input.name = name_itr->second;
184 }
185 the_input.offset = m_input_node_offset.at(input_n);
186 the_input.scale = m_input_node_scale.at(input_n);
187 inputs_vector.push_back(std::move(the_input));
188 }
189 return inputs_vector;
190}

◆ getnHidden() [1/2]

Int_t TTrainedNetwork::getnHidden ( ) const
inline

◆ getnHidden() [2/2]

Int_t TTrainedNetwork::getnHidden ( ) const
inline

◆ getnHiddenLayerSize() [1/2]

const std::vector< Int_t > & TTrainedNetwork::getnHiddenLayerSize ( ) const
inline

◆ getnHiddenLayerSize() [2/2]

const std::vector< Int_t > & TTrainedNetwork::getnHiddenLayerSize ( ) const
inline

◆ getnInput() [1/2]

Int_t TTrainedNetwork::getnInput ( ) const
inline

◆ getnInput() [2/2]

Int_t TTrainedNetwork::getnInput ( ) const
inline

◆ getnOutput() [1/2]

Int_t TTrainedNetwork::getnOutput ( ) const
inline

◆ getnOutput() [2/2]

Int_t TTrainedNetwork::getnOutput ( ) const
inline

◆ getThresholdVectors() [1/2]

const std::vector< TVectorD * > & TTrainedNetwork::getThresholdVectors ( ) const
inline

◆ getThresholdVectors() [2/2]

const std::vector< TVectorD * > & TTrainedNetwork::getThresholdVectors ( ) const
inline

◆ is_consistent()

bool TTrainedNetwork::is_consistent ( ) const
private

Definition at line 372 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

372 {
373 if (m_ThresholdVectors.size() != m_WeightMatrices.size()) {
374 std::cerr << "ERROR: "
375 << "n threshold vectors: " << m_ThresholdVectors.size()
376 << " n weight matrices: " << m_WeightMatrices.size()
377 << std::endl;
378 return false;
379 }
380 int nodes_last_layer = m_nInput;
381 for (unsigned layer_n = 0; layer_n < m_ThresholdVectors.size(); layer_n++){
382 int n_threshold_nodes = m_ThresholdVectors.at(layer_n)->GetNrows();
383 int n_weights_nodes = m_WeightMatrices.at(layer_n)->GetNcols();
384 if (n_threshold_nodes != n_weights_nodes) {
385 std::cerr << "ERROR: in layer " << layer_n
386 << " --- n threshold: " << n_threshold_nodes
387 << " n_weights: " << n_weights_nodes << std::endl;
388 return false;
389 }
390 int n_incoming_connections = m_WeightMatrices.at(layer_n)->GetNrows();
391 if (n_incoming_connections != nodes_last_layer) {
392 std::cerr << "ERROR: in layer " << layer_n
393 << " --- last layer nodes: " << nodes_last_layer
394 << " connected to this layer: " << n_incoming_connections
395 << std::endl;
396 return false;
397 }
398 nodes_last_layer = n_weights_nodes;
399 }
400
401 if (m_ThresholdVectors.size() - 1 != m_nHiddenLayerSize.size() ){
402 std::cerr << "ERROR: "
403 << "size m_ThresholdVectors: " << m_ThresholdVectors.size()
404 << " size m_nHiddenLayerSize: " << m_nHiddenLayerSize.size()
405 << std::endl;
406 return false;
407 }
408
409 return true;
410}

◆ setNewWeights() [1/2]

void TTrainedNetwork::setNewWeights ( std::vector< TVectorD * > & thresholdVectors,
std::vector< TMatrixD * > & weightMatrices )

Definition at line 67 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx.

69{
70
71 std::vector<TVectorD*>::const_iterator vectBegin=m_ThresholdVectors.begin();
72 std::vector<TVectorD*>::const_iterator vectEnd=m_ThresholdVectors.end();
73
74 for (std::vector<TVectorD*>::const_iterator vectIter=vectBegin;
75 vectIter!=vectEnd;
76 ++vectIter)
77 {
78 delete *vectIter;
79 }
80
81 std::vector<TMatrixD*>::const_iterator matrixBegin=m_WeightMatrices.begin();
82 std::vector<TMatrixD*>::const_iterator matrixEnd=m_WeightMatrices.end();
83
84 for (std::vector<TMatrixD*>::const_iterator matrixIter=matrixBegin;
85 matrixIter!=matrixEnd;
86 ++matrixIter)
87 {
88 delete *matrixIter;
89 }
90
91 m_ThresholdVectors.clear();
92 m_WeightMatrices.clear();
93
94 m_ThresholdVectors=thresholdVectors;
96
97}

◆ setNewWeights() [2/2]

void TTrainedNetwork::setNewWeights ( std::vector< TVectorD * > & thresholdVectors,
std::vector< TMatrixD * > & weightMatrices )

◆ setOffsets()

void TTrainedNetwork::setOffsets ( const std::vector< double > & offsets)

◆ setScales()

void TTrainedNetwork::setScales ( const std::vector< double > & scales)

Definition at line 70 of file Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils/src/TTrainedNetwork.cxx.

71{
72 assert(check_norm_size(scales.size()));
73 m_input_node_scale = scales;
74}

◆ sigmoid() [1/2]

Double_t TTrainedNetwork::sigmoid ( Double_t x) const
inlineprivate

◆ sigmoid() [2/2]

Double_t TTrainedNetwork::sigmoid ( Double_t x) const
private

◆ weightMatrices() [1/2]

const std::vector< TMatrixD * > & TTrainedNetwork::weightMatrices ( ) const
inline

◆ weightMatrices() [2/2]

const std::vector< TMatrixD * > & TTrainedNetwork::weightMatrices ( ) const
inline

Member Data Documentation

◆ linearOutput

const unsigned TTrainedNetwork::linearOutput = 1u << 0
static

◆ m_ActivationFunction

Int_t TTrainedNetwork::m_ActivationFunction
private

cache of the maximum needed size, not persisitified

Definition at line 75 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.h.

◆ m_bufferSizeMax

unsigned int TTrainedNetwork::m_bufferSizeMax
private

◆ m_input_node_offset

std::vector<Double_t> TTrainedNetwork::m_input_node_offset
private

◆ m_input_node_scale

std::vector<Double_t> TTrainedNetwork::m_input_node_scale
private

◆ m_inputStringToNode

std::map<std::string,int> TTrainedNetwork::m_inputStringToNode
private

◆ m_LinearOutput

bool TTrainedNetwork::m_LinearOutput
private

◆ m_maxExpValue

double TTrainedNetwork::m_maxExpValue
private

◆ m_nHidden [1/2]

Int_t TTrainedNetwork::m_nHidden
private

◆ m_nHidden [2/2]

unsigned TTrainedNetwork::m_nHidden
private

◆ m_nHiddenLayerSize

std::vector< Int_t > TTrainedNetwork::m_nHiddenLayerSize
private

◆ m_nInput [1/2]

Int_t TTrainedNetwork::m_nInput
private

◆ m_nInput [2/2]

unsigned TTrainedNetwork::m_nInput
private

◆ m_NormalizeOutput

bool TTrainedNetwork::m_NormalizeOutput
private

◆ m_nOutput [1/2]

Int_t TTrainedNetwork::m_nOutput
private

◆ m_nOutput [2/2]

unsigned TTrainedNetwork::m_nOutput
private

◆ m_ThresholdVectors

std::vector< TVectorD * > TTrainedNetwork::m_ThresholdVectors
private

◆ m_WeightMatrices

std::vector< TMatrixD * > TTrainedNetwork::m_WeightMatrices
private

◆ normalizeOutput

const unsigned TTrainedNetwork::normalizeOutput = 1u << 1
static

The documentation for this class was generated from the following files: