Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:11

0001 // @(#)root/tmva $Id$
0002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : Types                                                                 *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *      GLobal types (singleton class)                                            *
0012  *                                                                                *
0013  * Authors (alphabetical):                                                        *
0014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
0015  *      Peter Speckmayer <Peter.Speckmayer@cern.ch>  - CERN, Switzerland          *
0016  *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
0017  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
0018  *                                                                                *
0019  * Copyright (c) 2005:                                                            *
0020  *      CERN, Switzerland                                                         *
0021  *      U. of Victoria, Canada                                                    *
0022  *      MPI-K Heidelberg, Germany                                                 *
0023  *                                                                                *
0024  * Redistribution and use in source and binary forms, with or without             *
0025  * modification, are permitted according to the terms listed in LICENSE           *
0026  * (http://mva.sourceforge.net/license.txt)                                       *
0027  **********************************************************************************/
0028 
0029 #ifndef ROOT_TMVA_Types
0030 #define ROOT_TMVA_Types
0031 
0032 //////////////////////////////////////////////////////////////////////////
0033 //                                                                      //
0034 // Types                                                                //
0035 //                                                                      //
0036 // Singleton class for Global types used by TMVA                        //
0037 //                                                                      //
0038 //////////////////////////////////////////////////////////////////////////
0039 
0040 #include <map>
0041 #include <atomic>
0042 
0043 #include "RtypesCore.h"
0044 
0045 #include "TString.h"
0046 
0047 namespace TMVA {
0048 
0049    typedef UInt_t TMVAVersion_t;
0050 
0051    class MsgLogger;
0052 
0053    // message types for MsgLogger
0054    // define outside of Types class to facilite access
0055    enum EMsgType {
0056       kDEBUG   = 1,
0057       kVERBOSE = 2,
0058       kINFO    = 3,
0059       kWARNING = 4,
0060       kERROR   = 5,
0061       kFATAL   = 6,
0062       kSILENT  = 7,
0063       kHEADER  = 8
0064    };
0065 
0066    enum HistType { kMVAType = 0, kProbaType = 1, kRarityType = 2, kCompareType = 3 };
0067 
0068    //Variable Importance type
0069    enum VIType {kShort=0,kAll=1,kRandom=2};
0070 
0071    class Types {
0072 
0073    public:
0074 
0075       // available MVA methods
0076       enum EMVA {
0077          kVariable    = 0,
0078          kCuts           ,
0079          kLikelihood     ,
0080          kPDERS          ,
0081          kHMatrix        ,
0082          kFisher         ,
0083          kKNN            ,
0084          kCFMlpANN       ,
0085          kTMlpANN        ,
0086          kBDT            ,
0087          kDT             ,
0088          kRuleFit        ,
0089          kSVM            ,
0090          kMLP            ,
0091          kBayesClassifier,
0092          kFDA            ,
0093          kBoost          ,
0094          kPDEFoam        ,
0095          kLD             ,
0096          kPlugins        ,
0097          kCategory       ,
0098          kDNN            ,
0099          kDL             ,
0100          kPyRandomForest ,
0101          kPyAdaBoost     ,
0102          kPyGTB          ,
0103          kPyKeras        ,
0104          kPyTorch        ,
0105          kC50            ,
0106          kRSNNS          ,
0107          kRSVM           ,
0108          kRXGB           ,
0109          kCrossValidation,
0110          kMaxMethod
0111       };
0112 
0113       // available variable transformations
0114       enum EVariableTransform {
0115          kIdentity = 0,
0116          kDecorrelated,
0117          kNormalized,
0118          kPCA,
0119          kRearranged,
0120          kGauss,
0121          kUniform,
0122          kMaxVariableTransform
0123       };
0124 
0125       // type of analysis
0126       enum EAnalysisType {
0127          kClassification = 0,
0128          kRegression,
0129          kMulticlass,
0130          kNoAnalysisType,
0131          kMaxAnalysisType
0132       };
0133 
0134       enum ESBType {
0135          kSignal = 0,  ///< Never change this number - it is elsewhere assumed to be zero !
0136          kBackground,
0137          kSBBoth,
0138          kMaxSBType,
0139          kTrueType
0140       };
0141 
0142       enum ETreeType {
0143          kTraining = 0,
0144          kTesting,
0145          kMaxTreeType,  ///< also used as temporary storage for trees not yet assigned for testing;training...
0146          kValidation,   ///< these are placeholders... currently not used, but could be moved "forward" if
0147          kTrainingOriginal     ///< ever needed
0148       };
0149 
0150       enum EBoostStage {
0151          kBoostProcBegin=0,
0152          kBeforeTraining,
0153          kBeforeBoosting,
0154          kAfterBoosting,
0155          kBoostProcEnd
0156       };
0157 
0158    public:
0159 
0160       static Types& Instance();
0161       static void   DestroyInstance();
0162       ~Types();
0163 
0164       Types::EMVA   GetMethodType( const TString& method ) const;
0165       TString       GetMethodName( Types::EMVA    method ) const;
0166 
0167       Bool_t        AddTypeMapping(Types::EMVA method, const TString& methodname);
0168 
0169    private:
0170 
0171       Types();
0172 #if !defined _MSC_VER
0173       static std::atomic<Types*> fgTypesPtr;
0174 #else
0175       static Types* fgTypesPtr;
0176 #endif
0177 
0178    private:
0179 
0180       std::map<TString, TMVA::Types::EMVA> fStr2type; ///< types-to-text map
0181       mutable MsgLogger* fLogger;   ///<! message logger
0182       MsgLogger& Log() const { return *fLogger; }
0183 
0184    };
0185 }
0186 
0187 #endif