ROOT  6.06/09
Reference Guide
TNeuronInputAbs.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::TNeuronInputAbs *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * TNeuron input calculator -- calculates the sum of the absolute values *
12  * of the weighted 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_TNeuronInputAbs
27 #define ROOT_TMVA_TNeuronInputAbs
28 
29 //////////////////////////////////////////////////////////////////////////
30 // //
31 // TNeuronInputAbs //
32 // //
33 // TNeuron input calculator -- calculates the sum of the absolute //
34 // values of the weighted inputs //
35 // //
36 //////////////////////////////////////////////////////////////////////////
37 
38 // ROOT_VERSION(5,15,02) = (5<<16)+(15<<8)+2 = 364802
39 // we use the hardcoded number here since CINT does not easily understand macros
40 // we tried using rootcints -p option, but that causes rootcint to pick up
41 // things from the ROOT version of TMVA
42 
43 // #if ROOT_VERSION_CODE >= 364802
44 #ifndef ROOT_TMathBase
45 #include "TMathBase.h"
46 #endif
47 // #else
48 // #ifndef ROOT_TMath
49 // #include "TMath.h"
50 // #endif
51 // #endif
52 
53 #ifndef ROOT_TObject
54 #include "TObject.h"
55 #endif
56 #ifndef ROOT_TString
57 #include "TString.h"
58 #endif
59 
60 #ifndef ROOT_TMVA_TNeuronInput
61 #include "TMVA/TNeuronInput.h"
62 #endif
63 
64 #ifndef ROOT_TMVA_TNeuron
65 #include "TMVA/TNeuron.h"
66 #endif
67 
68 namespace TMVA {
69 
70  class TNeuronInputAbs : public TNeuronInput {
71 
72  public:
73 
75  virtual ~TNeuronInputAbs() {}
76 
77  // calculate the input value for the neuron
78  Double_t GetInput( const TNeuron* neuron ) const {
79  if (neuron->IsInputNeuron()) return 0;
80  Double_t result = 0;
81  for (Int_t i=0; i < neuron->NumPreLinks(); i++)
82  result += TMath::Abs(neuron->PreLinkAt(i)->GetWeightedValue());
83  return result;
84  }
85 
86  // name of the class
87  TString GetName() { return "Sum of weighted activations (absolute value)"; }
88 
89  ClassDef(TNeuronInputAbs,0) // Calculates the sum of the absolute values of the weighted inputs
90  };
91 
92 } // namespace TMVA
93 
94 #endif
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t GetInput(const TNeuron *neuron) const
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