Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:11

0001 // @(#)root/tmva $Id$
0002 // Author: Matt Jachowski
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : TMVA::TNeuronInputAbs                                                 *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *      TNeuron input calculator -- calculates the sum of the absolute values     *
0012  *      of the weighted inputs                                                    *
0013  *                                                                                *
0014  * Authors (alphabetical):                                                        *
0015  *      Matt Jachowski  <jachowski@stanford.edu> - Stanford University, USA       *
0016  *                                                                                *
0017  * Copyright (c) 2005:                                                            *
0018  *      CERN, Switzerland                                                         *
0019  *                                                                                *
0020  * Redistribution and use in source and binary forms, with or without             *
0021  * modification, are permitted according to the terms listed in LICENSE           *
0022  * (see tmva/doc/LICENSE)                                          *
0023  **********************************************************************************/
0024 
0025 
0026 #ifndef ROOT_TMVA_TNeuronInputAbs
0027 #define ROOT_TMVA_TNeuronInputAbs
0028 
0029 //////////////////////////////////////////////////////////////////////////
0030 //                                                                      //
0031 // TNeuronInputAbs                                                      //
0032 //                                                                      //
0033 // TNeuron input calculator -- calculates the sum of the absolute       //
0034 // values of the weighted inputs                                        //
0035 //                                                                      //
0036 //////////////////////////////////////////////////////////////////////////
0037 
0038 #include "TMathBase.h"
0039 
0040 #include "TMVA/TNeuronInput.h"
0041 
0042 #include "TMVA/TNeuron.h"
0043 
0044 namespace TMVA {
0045 
0046    class TNeuronInputAbs : public TNeuronInput {
0047 
0048    public:
0049 
0050       TNeuronInputAbs() {}
0051       virtual ~TNeuronInputAbs() {}
0052 
0053       // calculate the input value for the neuron
0054       Double_t GetInput( const TNeuron* neuron ) const {
0055          if (neuron->IsInputNeuron()) return 0;
0056          Double_t result = 0;
0057          for (Int_t i=0; i < neuron->NumPreLinks(); i++)
0058             result += TMath::Abs(neuron->PreLinkAt(i)->GetWeightedValue());
0059          return result;
0060       }
0061 
0062       // name of the class
0063       TString GetName() { return "Sum of weighted activations (absolute value)"; }
0064 
0065       ClassDef(TNeuronInputAbs,0); // Calculates the sum of the absolute values of the weighted inputs
0066    };
0067 
0068 } // namespace TMVA
0069 
0070 #endif