Logo ROOT   6.10/09
Reference Guide
ROCCurve.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Omar Zapata, Lorenzo Moneta, Sergei Gleyzer, Kim Albertsson
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : ROCCurve *
8  * *
9  * Description: *
10  * This is class to compute ROC Integral (AUC) *
11  * *
12  * Authors : *
13  * Omar Zapata <Omar.Zapata@cern.ch> - UdeA/ITM Colombia *
14  * Lorenzo Moneta <Lorenzo.Moneta@cern.ch> - CERN, Switzerland *
15  * Sergei Gleyzer <Sergei.Gleyzer@cern.ch> - U of Florida & CERN *
16  * Kim Albertsson <kim.albertsson@cern.ch> - LTU & CERN *
17  * *
18  * Copyright (c) 2015: *
19  * CERN, Switzerland *
20  * UdeA/ITM, Colombia *
21  * U. of Florida, USA *
22  **********************************************************************************/
23 #ifndef ROOT_TMVA_ROCCurve
24 #define ROOT_TMVA_ROCCurve
25 
26 #include "Rtypes.h"
27 
28 #include <iomanip>
29 #include <iostream>
30 #include <sstream>
31 #include <vector>
32 
33 class TList;
34 class TTree;
35 class TString;
36 class TH1;
37 class TH2;
38 class TH2F;
39 class TSpline;
40 class TSpline1;
41 class TGraph;
42 
43 namespace TMVA {
44 
45 class MsgLogger;
46 
47 class ROCCurve {
48 
49 public:
50  ROCCurve(const std::vector<Float_t> &mvaValues, const std::vector<Bool_t> &mvaTargets,
51  const std::vector<Float_t> &mvaWeights);
52 
53  ROCCurve(const std::vector<Float_t> &mvaValues, const std::vector<Bool_t> &mvaTargets);
54 
55  ROCCurve(const std::vector<Float_t> &mvaSignal, const std::vector<Float_t> &mvaBackground,
56  const std::vector<Float_t> &mvaSignalWeights, const std::vector<Float_t> &mvaBackgroundWeights);
57 
58  ROCCurve(const std::vector<Float_t> &mvaSignal, const std::vector<Float_t> &mvaBackground);
59 
60  ~ROCCurve();
61 
62  Double_t GetEffSForEffB(Double_t effB, const UInt_t num_points = 41);
63 
65  TGraph *GetROCCurve(const UInt_t points = 100); // n divisions = #points -1
66 
67 private:
68  mutable MsgLogger *fLogger; //! message logger
69  MsgLogger &Log() const { return *fLogger; }
70 
72 
73  std::vector<Float_t> fMvaSignal;
74  std::vector<Float_t> fMvaBackground;
75  std::vector<Float_t> fMvaSignalWeights;
76  std::vector<Float_t> fMvaBackgroundWeights;
77 
78  std::vector<Double_t> ComputeSensitivity(const UInt_t num_points);
79  std::vector<Double_t> ComputeSpecificity(const UInt_t num_points);
80 };
81 }
82 #endif
MsgLogger * fLogger
Definition: ROCCurve.h:68
std::vector< Float_t > fMvaSignal
Definition: ROCCurve.h:73
Double_t GetEffSForEffB(Double_t effB, const UInt_t num_points=41)
Calculate the signal efficiency (sensitivity) for a given background efficiency (sensitivity).
Definition: ROCCurve.cxx:199
ROCCurve(const std::vector< Float_t > &mvaValues, const std::vector< Bool_t > &mvaTargets, const std::vector< Float_t > &mvaWeights)
Definition: ROCCurve.cxx:45
Double_t GetROCIntegral(const UInt_t points=41)
Calculates the ROC integral (AUC)
Definition: ROCCurve.cxx:230
TGraph * fGraph
Definition: ROCCurve.h:71
Base class for spline implementation containing the Draw/Paint methods.
Definition: TSpline.h:20
~ROCCurve()
destructor
Definition: ROCCurve.cxx:107
Basic string class.
Definition: TString.h:129
std::vector< Double_t > ComputeSpecificity(const UInt_t num_points)
Definition: ROCCurve.cxx:115
std::vector< Float_t > fMvaSignalWeights
Definition: ROCCurve.h:75
A doubly linked list.
Definition: TList.h:43
point * points
Definition: X3DBuffer.c:20
Service class for 2-Dim histogram classes.
Definition: TH2.h:30
tomato 2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:249
unsigned int UInt_t
Definition: RtypesCore.h:42
double Double_t
Definition: RtypesCore.h:55
The TH1 histogram class.
Definition: TH1.h:56
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
std::vector< Double_t > ComputeSensitivity(const UInt_t num_points)
Definition: ROCCurve.cxx:154
Abstract ClassifierFactory template that handles arbitrary types.
TGraph * GetROCCurve(const UInt_t points=100)
Returns a new TGraph containing the ROC curve.
Definition: ROCCurve.cxx:256
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
A TTree object has a header with a name and a title.
Definition: TTree.h:78
MsgLogger & Log() const
message logger
Definition: ROCCurve.h:69
std::vector< Float_t > fMvaBackgroundWeights
Definition: ROCCurve.h:76
std::vector< Float_t > fMvaBackground
Definition: ROCCurve.h:74