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::TNeuronInputChooser                                             *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *      Class for easily choosing neuron input functions.                         *
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_TNeuronInputChooser
0026 #define ROOT_TMVA_TNeuronInputChooser
0027 
0028 //////////////////////////////////////////////////////////////////////////
0029 //                                                                      //
0030 // TNeuronInputChooser                                                  //
0031 //                                                                      //
0032 // Class for easily choosing neuron input functions                     //
0033 //                                                                      //
0034 //////////////////////////////////////////////////////////////////////////
0035 
0036 #include <vector>
0037 #ifndef ROOT_TString
0038 #include "TString.h"
0039 #endif
0040 
0041 #ifndef ROOT_TMVA_TActivation
0042 #ifndef ROOT_TNeuronInput
0043 #include "TNeuronInput.h"
0044 #endif
0045 #endif
0046 #ifndef ROOT_TMVA_TNeuronInputSum
0047 #ifndef ROOT_TNeuronInputSum
0048 #include "TNeuronInputSum.h"
0049 #endif
0050 #endif
0051 #ifndef ROOT_TMVA_TNeuronInputSqSum
0052 #ifndef ROOT_TNeuronInputSqSum
0053 #include "TNeuronInputSqSum.h"
0054 #endif
0055 #endif
0056 #ifndef ROOT_TMVA_TNeuronInputAbs
0057 #ifndef ROOT_TNeuronInputAbs
0058 #include "TNeuronInputAbs.h"
0059 #endif
0060 #endif
0061 
0062 namespace TMVA {
0063 
0064    class TNeuron;
0065 
0066    class TNeuronInputChooser {
0067 
0068    public:
0069 
0070       TNeuronInputChooser()
0071          {
0072             fSUM    = "sum";
0073             fSQSUM  = "sqsum";
0074             fABSSUM = "abssum";
0075          }
0076       virtual ~TNeuronInputChooser() {}
0077 
0078       enum ENeuronInputType { kSum = 0,
0079                               kSqSum,
0080                               kAbsSum
0081       };
0082 
0083       TNeuronInput* CreateNeuronInput(ENeuronInputType type) const
0084       {
0085          switch (type) {
0086          case kSum:    return new TNeuronInputSum();
0087          case kSqSum:  return new TNeuronInputSqSum();
0088          case kAbsSum: return new TNeuronInputAbs();
0089          default: return nullptr;
0090          }
0091          return nullptr;
0092       }
0093 
0094       TNeuronInput* CreateNeuronInput(const TString type) const
0095       {
0096          if      (type == fSUM)    return CreateNeuronInput(kSum);
0097          else if (type == fSQSUM)  return CreateNeuronInput(kSqSum);
0098          else if (type == fABSSUM) return CreateNeuronInput(kAbsSum);
0099          else                      return nullptr;
0100       }
0101 
0102       std::vector<TString>* GetAllNeuronInputNames() const
0103          {
0104             std::vector<TString>* names = new std::vector<TString>();
0105             names->push_back(fSUM);
0106             names->push_back(fSQSUM);
0107             names->push_back(fABSSUM);
0108             return names;
0109          }
0110 
0111    private:
0112 
0113       TString fSUM;    ///< neuron input type name
0114       TString fSQSUM;  ///< neuron input type name
0115       TString fABSSUM; ///< neuron input type name
0116 
0117       ClassDef(TNeuronInputChooser,0); // Class for choosing neuron input functions
0118    };
0119 
0120 } // namespace TMVA
0121 
0122 #endif