TNeuronInputAbs.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: TNeuronInputAbs.h 29122 2009-06-22 06:51:30Z brun $
00002 // Author: Matt Jachowski 
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : TMVA::TNeuronInputAbs                                                 *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      TNeuron input calculator -- calculates the sum of the absolute values     *
00012  *      of the weighted inputs                                                    *
00013  *                                                                                *
00014  * Authors (alphabetical):                                                        *
00015  *      Matt Jachowski  <jachowski@stanford.edu> - Stanford University, USA       *
00016  *                                                                                *
00017  * Copyright (c) 2005:                                                            *
00018  *      CERN, Switzerland                                                         *
00019  *                                                                                *
00020  * Redistribution and use in source and binary forms, with or without             *
00021  * modification, are permitted according to the terms listed in LICENSE           *
00022  * (http://tmva.sourceforge.net/LICENSE)                                          *
00023  **********************************************************************************/
00024  
00025 
00026 #ifndef ROOT_TMVA_TNeuronInputAbs
00027 #define ROOT_TMVA_TNeuronInputAbs
00028 
00029 //////////////////////////////////////////////////////////////////////////
00030 //                                                                      //
00031 // TNeuronInputAbs                                                      //
00032 //                                                                      //
00033 // TNeuron input calculator -- calculates the sum of the absolute       //
00034 // values of the weighted inputs                                        //
00035 //                                                                      //
00036 //////////////////////////////////////////////////////////////////////////
00037 
00038 // ROOT_VERSION(5,15,02) = (5<<16)+(15<<8)+2 = 364802
00039 // we use the hardcoded number here since CINT does not easily understand macros
00040 // we tried using rootcints -p option, but that causes rootcint to pick up
00041 // things from the ROOT version of TMVA
00042 
00043 #if ROOT_VERSION_CODE >= 364802
00044 #ifndef ROOT_TMathBase
00045 #include "TMathBase.h"
00046 #endif
00047 #else
00048 #ifndef ROOT_TMath
00049 #include "TMath.h"
00050 #endif
00051 #endif
00052 
00053 #ifndef ROOT_TObject
00054 #include "TObject.h"
00055 #endif
00056 #ifndef ROOT_TString
00057 #include "TString.h"
00058 #endif
00059 
00060 #ifndef ROOT_TMVA_TNeuronInput
00061 #include "TMVA/TNeuronInput.h"
00062 #endif
00063 
00064 #ifndef ROOT_TMVA_TNeuron
00065 #include "TMVA/TNeuron.h"
00066 #endif
00067 
00068 namespace TMVA {
00069   
00070    class TNeuronInputAbs : public TNeuronInput {
00071     
00072    public:
00073 
00074       TNeuronInputAbs() {}
00075       virtual ~TNeuronInputAbs() {}
00076 
00077       // calculate the input value for the neuron
00078       Double_t GetInput( const TNeuron* neuron ) const {
00079          if (neuron->IsInputNeuron()) return 0;
00080          Double_t result = 0;
00081          for (Int_t i=0; i < neuron->NumPreLinks(); i++)
00082             result += TMath::Abs(neuron->PreLinkAt(i)->GetWeightedValue());
00083          return result;
00084       }
00085 
00086       // name of the class
00087       TString GetName() { return "Sum of weighted activations (absolute value)"; }
00088 
00089       ClassDef(TNeuronInputAbs,0) // Calculates the sum of the absolute values of the weighted inputs
00090    };
00091 
00092 } // namespace TMVA
00093 
00094 #endif

Generated on Tue Jul 5 14:27:39 2011 for ROOT_528-00b_version by  doxygen 1.5.1