TNeuronInputSum.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: TNeuronInputSum.h 31458 2009-11-30 13:58:20Z stelzer $
00002 // Author: Matt Jachowski
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : TMVA::TNeuronInputSum                                                 *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      TNeuron input calculator -- calculates the weighted sum of inputs.        *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Matt Jachowski  <jachowski@stanford.edu> - Stanford University, USA       *
00015  *                                                                                *
00016  * Copyright (c) 2005:                                                            *
00017  *      CERN, Switzerland                                                         *
00018  *                                                                                *
00019  * Redistribution and use in source and binary forms, with or without             *
00020  * modification, are permitted according to the terms listed in LICENSE           *
00021  * (http://tmva.sourceforge.net/LICENSE)                                          *
00022  **********************************************************************************/
00023  
00024 
00025 #ifndef ROOT_TMVA_TNeuronInputSum
00026 #define ROOT_TMVA_TNeuronInputSum
00027 
00028 //////////////////////////////////////////////////////////////////////////
00029 //                                                                      //
00030 // TNeuronInputSum                                                      //
00031 //                                                                      //
00032 // TNeuron input calculator -- calculates the weighted sum of inputs    //
00033 //                                                                      //
00034 //////////////////////////////////////////////////////////////////////////
00035 
00036 #ifndef ROOT_TObject
00037 #include "TObject.h"
00038 #endif
00039 #ifndef ROOT_TString
00040 #include "TString.h"
00041 #endif
00042 
00043 #ifndef ROOT_TMVA_TNeuronInput
00044 #include "TMVA/TNeuronInput.h"
00045 #endif
00046 #ifndef ROOT_TMVA_TNeuron
00047 #include "TMVA/TNeuron.h"
00048 #endif
00049 
00050 namespace TMVA {
00051 
00052    class TNeuronInputSum : public TNeuronInput {
00053     
00054    public:
00055 
00056       TNeuronInputSum() {}
00057       virtual ~TNeuronInputSum() {}
00058 
00059       // calculate input value for neuron
00060       Double_t GetInput( const TNeuron* neuron ) const {
00061          if (neuron->IsInputNeuron()) return 0;
00062          Double_t result = 0;
00063          Int_t npl = neuron->NumPreLinks();
00064          for (Int_t i=0; i < npl; i++) {
00065             result += neuron->PreLinkAt(i)->GetWeightedValue();
00066          }
00067          return result;
00068       }
00069 
00070       // name of class
00071       TString GetName() { return "Sum of weighted activations"; }
00072 
00073       ClassDef(TNeuronInputSum,0) // Calculates weighted sum of neuron inputs
00074    };
00075 
00076 } // namespace TMVA
00077 
00078 #endif

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