Logo ROOT   6.12/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 #include "TObject.h"
39 #include "TString.h"
40 
41 #include "TMVA/TNeuronInput.h"
42 #include "TMVA/TNeuron.h"
43 
44 namespace TMVA {
45 
47 
48  public:
49 
51  virtual ~TNeuronInputSqSum() {}
52 
53  // calculate the input value for the neuron
54  Double_t GetInput( const TNeuron* neuron ) const {
55  if (neuron->IsInputNeuron()) return 0;
56  Double_t result = 0;
57  for (Int_t i=0; i < neuron->NumPreLinks(); i++) {
58  Double_t val = neuron->PreLinkAt(i)->GetWeightedValue();
59  result += val*val;
60  }
61  return result;
62  }
63 
64  // name of the class
65  TString GetName() { return "Sum of weighted activations squared"; }
66 
67  ClassDef(TNeuronInputSqSum,0); // Calculates square of weighted sum of neuron inputs
68  };
69 
70 } // namespace TMVA
71 
72 #endif
Bool_t IsInputNeuron() const
Definition: TNeuron.h:116
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
#define ClassDef(name, id)
Definition: Rtypes.h:320
Neuron class used by TMVA artificial neural network methods.
Definition: TNeuron.h:49
Int_t NumPreLinks() const
Definition: TNeuron.h:108
TSynapse * PreLinkAt(Int_t index) const
Definition: TNeuron.h:110
double Double_t
Definition: RtypesCore.h:55
Double_t GetInput(const TNeuron *neuron) const
TNeuron input calculator – calculates the squared weighted sum of inputs.
Abstract ClassifierFactory template that handles arbitrary types.
Interface for TNeuron input calculation classes.
Definition: TNeuronInput.h:42
Double_t GetWeightedValue()
get output of pre-neuron weighted by synapse weight
Definition: TSynapse.cxx:77