Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 #include "TMathBase.h"
39 
40 #include "TObject.h"
41 #include "TString.h"
42 
43 #include "TMVA/TNeuronInput.h"
44 
45 #include "TMVA/TNeuron.h"
46 
47 namespace TMVA {
48 
49  class TNeuronInputAbs : public TNeuronInput {
50 
51  public:
52 
53  TNeuronInputAbs() {}
54  virtual ~TNeuronInputAbs() {}
55 
56  // calculate the input value for the neuron
57  Double_t GetInput( const TNeuron* neuron ) const {
58  if (neuron->IsInputNeuron()) return 0;
59  Double_t result = 0;
60  for (Int_t i=0; i < neuron->NumPreLinks(); i++)
61  result += TMath::Abs(neuron->PreLinkAt(i)->GetWeightedValue());
62  return result;
63  }
64 
65  // name of the class
66  TString GetName() { return "Sum of weighted activations (absolute value)"; }
67 
68  ClassDef(TNeuronInputAbs,0); // Calculates the sum of the absolute values of the weighted inputs
69  };
70 
71 } // namespace TMVA
72 
73 #endif