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