00001 // @(#)root/tmva $Id: TNeuronInputChooser.h 29122 2009-06-22 06:51:30Z brun $ 00002 // Author: Matt Jachowski 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : TMVA::TNeuronInputChooser * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: * 00011 * Class for easily choosing neuron input functions. * 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_TNeuronInputChooser 00026 #define ROOT_TMVA_TNeuronInputChooser 00027 00028 ////////////////////////////////////////////////////////////////////////// 00029 // // 00030 // TNeuronInputChooser // 00031 // // 00032 // Class for easily choosing neuron input functions // 00033 // // 00034 ////////////////////////////////////////////////////////////////////////// 00035 00036 #include <vector> 00037 #ifndef ROOT_TString 00038 #include "TString.h" 00039 #endif 00040 00041 #ifndef ROOT_TMVA_TActivation 00042 #ifndef ROOT_TNeuronInput 00043 #include "TNeuronInput.h" 00044 #endif 00045 #endif 00046 #ifndef ROOT_TMVA_TNeuronInputSum 00047 #ifndef ROOT_TNeuronInputSum 00048 #include "TNeuronInputSum.h" 00049 #endif 00050 #endif 00051 #ifndef ROOT_TMVA_TNeuronInputSqSum 00052 #ifndef ROOT_TNeuronInputSqSum 00053 #include "TNeuronInputSqSum.h" 00054 #endif 00055 #endif 00056 #ifndef ROOT_TMVA_TNeuronInputAbs 00057 #ifndef ROOT_TNeuronInputAbs 00058 #include "TNeuronInputAbs.h" 00059 #endif 00060 #endif 00061 00062 namespace TMVA { 00063 00064 class TNeuron; 00065 00066 class TNeuronInputChooser { 00067 00068 public: 00069 00070 TNeuronInputChooser() 00071 { 00072 fSUM = "sum"; 00073 fSQSUM = "sqsum"; 00074 fABSSUM = "abssum"; 00075 } 00076 virtual ~TNeuronInputChooser() {} 00077 00078 enum ENeuronInputType { kSum = 0, 00079 kSqSum, 00080 kAbsSum 00081 }; 00082 00083 TNeuronInput* CreateNeuronInput(ENeuronInputType type) const 00084 { 00085 switch (type) { 00086 case kSum: return new TNeuronInputSum(); 00087 case kSqSum: return new TNeuronInputSqSum(); 00088 case kAbsSum: return new TNeuronInputAbs(); 00089 default: return NULL; 00090 } 00091 return NULL; 00092 } 00093 00094 TNeuronInput* CreateNeuronInput(const TString type) const 00095 { 00096 if (type == fSUM) return CreateNeuronInput(kSum); 00097 else if (type == fSQSUM) return CreateNeuronInput(kSqSum); 00098 else if (type == fABSSUM) return CreateNeuronInput(kAbsSum); 00099 else return NULL; 00100 } 00101 00102 std::vector<TString>* GetAllNeuronInputNames() const 00103 { 00104 std::vector<TString>* names = new std::vector<TString>(); 00105 names->push_back(fSUM); 00106 names->push_back(fSQSUM); 00107 names->push_back(fABSSUM); 00108 return names; 00109 } 00110 00111 private: 00112 00113 TString fSUM; // neuron input type name 00114 TString fSQSUM; // neuron input type name 00115 TString fABSSUM; // neuron input type name 00116 00117 ClassDef(TNeuronInputChooser,0) // Class for choosing neuron input functions 00118 }; 00119 00120 } // namespace TMVA 00121 00122 #endif