Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:23:04

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