Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/tmva $Id$
0002 // Author: Omar Zapata, Lorenzo Moneta, Sergei Gleyzer, Kim Albertsson
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : ROCCurve                                                              *
0008  *                                                                                *
0009  * Description:                                                                   *
0010  *      This is class to compute ROC Integral (AUC)                               *
0011  *                                                                                *
0012  * Authors :                                                                      *
0013  *      Omar Zapata     <Omar.Zapata@cern.ch>    - UdeA/ITM Colombia              *
0014  *      Lorenzo Moneta  <Lorenzo.Moneta@cern.ch> - CERN, Switzerland              *
0015  *      Sergei Gleyzer  <Sergei.Gleyzer@cern.ch> - U of Florida & CERN            *
0016  *      Kim Albertsson  <kim.albertsson@cern.ch> - LTU & CERN                     *
0017  *                                                                                *
0018  * Copyright (c) 2015:                                                            *
0019  *      CERN, Switzerland                                                         *
0020  *      UdeA/ITM, Colombia                                                        *
0021  *      U. of Florida, USA                                                        *
0022  **********************************************************************************/
0023 #ifndef ROOT_TMVA_ROCCurve
0024 #define ROOT_TMVA_ROCCurve
0025 
0026 #include "RtypesCore.h"
0027 
0028 #include <tuple>
0029 #include <utility>
0030 #include <vector>
0031 
0032 class TList;
0033 class TTree;
0034 class TString;
0035 class TH1;
0036 class TH2;
0037 class TH2F;
0038 class TSpline;
0039 class TSpline1;
0040 class TGraph;
0041 
0042 namespace TMVA {
0043 
0044 class MsgLogger;
0045 
0046 class ROCCurve {
0047 
0048 public:
0049    ROCCurve(const std::vector<std::tuple<Float_t, Float_t, Bool_t>> &mvas);
0050 
0051    ROCCurve(const std::vector<Float_t> &mvaValues, const std::vector<Bool_t> &mvaTargets,
0052             const std::vector<Float_t> &mvaWeights);
0053 
0054    ROCCurve(const std::vector<Float_t> &mvaValues, const std::vector<Bool_t> &mvaTargets);
0055 
0056    ROCCurve(const std::vector<Float_t> &mvaSignal, const std::vector<Float_t> &mvaBackground,
0057             const std::vector<Float_t> &mvaSignalWeights, const std::vector<Float_t> &mvaBackgroundWeights);
0058 
0059    ROCCurve(const std::vector<Float_t> &mvaSignal, const std::vector<Float_t> &mvaBackground);
0060 
0061    ~ROCCurve();
0062 
0063    Double_t GetEffSForEffB(Double_t effB, const UInt_t num_points = 41);
0064 
0065    Double_t GetROCIntegral(const UInt_t points = 41);
0066    TGraph *GetROCCurve(const UInt_t points = 100); // n divisions = #points -1
0067 
0068    const std::vector<std::tuple<Float_t, Float_t, Bool_t>> GetMvas() const { return fMva; }
0069 private:
0070    mutable MsgLogger *fLogger; ///<! message logger
0071    MsgLogger &Log() const;
0072 
0073    TGraph *fGraph;
0074 
0075    std::vector<std::tuple<Float_t, Float_t, Bool_t>> fMva;
0076 
0077    std::vector<Double_t> ComputeSensitivity(const UInt_t num_points);
0078    std::vector<Double_t> ComputeSpecificity(const UInt_t num_points);
0079 };
0080 }
0081 #endif