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::TNeuronInputSqSum                                               *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *       TNeuron input calculator -- calculates the square                        *
0012  *       of the weighted sum of 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_TNeuronInputSqSum
0027 #define ROOT_TMVA_TNeuronInputSqSum
0028 
0029 //////////////////////////////////////////////////////////////////////////
0030 //                                                                      //
0031 // TNeuronInputSqSum                                                    //
0032 //                                                                      //
0033 // TNeuron input calculator -- calculates the squared weighted sum of   //
0034 // inputs                                                               //
0035 //                                                                      //
0036 //////////////////////////////////////////////////////////////////////////
0037 
0038 #include "TMVA/TNeuronInput.h"
0039 #include "TMVA/TNeuron.h"
0040 
0041 namespace TMVA {
0042 
0043    class TNeuronInputSqSum : public TNeuronInput {
0044 
0045    public:
0046 
0047       TNeuronInputSqSum() {}
0048       virtual ~TNeuronInputSqSum() {}
0049 
0050       // calculate the input value for the neuron
0051       Double_t GetInput( const TNeuron* neuron ) const {
0052          if (neuron->IsInputNeuron()) return 0;
0053          Double_t result = 0;
0054          for (Int_t i=0; i < neuron->NumPreLinks(); i++) {
0055             Double_t val = neuron->PreLinkAt(i)->GetWeightedValue();
0056             result += val*val;
0057          }
0058          return result;
0059       }
0060 
0061       // name of the class
0062       TString GetName() { return "Sum of weighted activations squared"; }
0063 
0064       ClassDef(TNeuronInputSqSum,0); // Calculates square of  weighted sum of neuron inputs
0065    };
0066 
0067 } // namespace TMVA
0068 
0069 #endif