ROOT  6.06/09
Reference Guide
TNeuronInputSum.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Matt Jachowski
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : TMVA::TNeuronInputSum *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * TNeuron input calculator -- calculates the weighted sum of inputs. *
12  * *
13  * Authors (alphabetical): *
14  * Matt Jachowski <jachowski@stanford.edu> - Stanford University, USA *
15  * *
16  * Copyright (c) 2005: *
17  * CERN, Switzerland *
18  * *
19  * Redistribution and use in source and binary forms, with or without *
20  * modification, are permitted according to the terms listed in LICENSE *
21  * (http://tmva.sourceforge.net/LICENSE) *
22  **********************************************************************************/
23 
24 
25 #ifndef ROOT_TMVA_TNeuronInputSum
26 #define ROOT_TMVA_TNeuronInputSum
27 
28 //////////////////////////////////////////////////////////////////////////
29 // //
30 // TNeuronInputSum //
31 // //
32 // TNeuron input calculator -- calculates the weighted sum of inputs //
33 // //
34 //////////////////////////////////////////////////////////////////////////
35 
36 #ifndef ROOT_TObject
37 #include "TObject.h"
38 #endif
39 #ifndef ROOT_TString
40 #include "TString.h"
41 #endif
42 
43 #ifndef ROOT_TMVA_TNeuronInput
44 #include "TMVA/TNeuronInput.h"
45 #endif
46 #ifndef ROOT_TMVA_TNeuron
47 #include "TMVA/TNeuron.h"
48 #endif
49 
50 namespace TMVA {
51 
52  class TNeuronInputSum : public TNeuronInput {
53 
54  public:
55 
57  virtual ~TNeuronInputSum() {}
58 
59  // calculate input value for neuron
60  Double_t GetInput( const TNeuron* neuron ) const {
61  if (neuron->IsInputNeuron()) return 0;
62  Double_t result = 0;
63  Int_t npl = neuron->NumPreLinks();
64  for (Int_t i=0; i < npl; i++) {
65  result += neuron->PreLinkAt(i)->GetWeightedValue();
66  }
67  return result;
68  }
69 
70  // name of class
71  TString GetName() { return "Sum of weighted activations"; }
72 
73  ClassDef(TNeuronInputSum,0) // Calculates weighted sum of neuron inputs
74  };
75 
76 } // namespace TMVA
77 
78 #endif
Double_t GetInput(const TNeuron *neuron) const
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
#define ClassDef(name, id)
Definition: Rtypes.h:254
Bool_t IsInputNeuron() const
Definition: TNeuron.h:128
double Double_t
Definition: RtypesCore.h:55
Abstract ClassifierFactory template that handles arbitrary types.
Double_t GetWeightedValue()
get output of pre-neuron weighted by synapse weight
Definition: TSynapse.cxx:79
Int_t NumPreLinks() const
Definition: TNeuron.h:120
double result[121]
TSynapse * PreLinkAt(Int_t index) const
Definition: TNeuron.h:122