Logo ROOT  
Reference Guide
SdivSqrtSplusB.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : SdivSqrtSplusB *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: Implementation of the SdivSqrtSplusB as separation criterion *
11  * s / sqrt( s+b ) *
12  * *
13  * *
14  * Authors (alphabetical): *
15  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
16  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
17  * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
18  * *
19  * Copyright (c) 2005: *
20  * CERN, Switzerland *
21  * U. of Victoria, Canada *
22  * Heidelberg U., Germany *
23  * *
24  * Redistribution and use in source and binary forms, with or without *
25  * modification, are permitted according to the terms listed in LICENSE *
26  * (http://tmva.sourceforge.net/LICENSE) *
27  **********************************************************************************/
28 
29 /*! \class TMVA::SdivSqrtSplusB
30 \ingroup TMVA
31 Implementation of the SdivSqrtSplusB as separation criterion.
32 
33 \f$ Index = \frac{S}{\sqrt{S+B}} \f$ (statistical significance)
34 */
35 
36 #include "TMath.h"
37 #include "TMVA/SdivSqrtSplusB.h"
38 
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// Index = S/sqrt(S+B) (statistical significance)
43 
45 {
46  if (s+b > 0) return s / TMath::Sqrt(s+b);
47  else return 0;
48 }
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// Separation Gain:
52 /// the measure of how the quality of separation of the sample increases
53 /// by splitting the sample e.g. into a "left-node" and a "right-node"
54 /// (N * Index_parent) - (N_left * Index_left) - (N_right * Index_right)
55 /// this is then the quality criterion which is optimized for when trying
56 /// to increase the information in the system (making the best selection
57 
59  const Double_t nTotS, const Double_t nTotB)
60 {
61  if ( (nTotS-nSelS)==nSelS && (nTotB-nSelB)==nSelB) return 0.;
62 
63  Double_t parentIndex = (nTotS+nTotB) *this->GetSeparationIndex(nTotS,nTotB);
64 
65  Double_t leftIndex = ( ((nTotS - nSelS) + (nTotB - nSelB))
66  * this->GetSeparationIndex(nTotS-nSelS,nTotB-nSelB) );
67  Double_t rightIndex = (nSelS+nSelB) * this->GetSeparationIndex(nSelS,nSelB);
68 
69  //Double_t diff = parentIndex - leftIndex - rightIndex;
70  Double_t diff = (parentIndex - leftIndex - rightIndex)/(nTotS+nTotB);
71 
72  if(diff<fPrecisionCut ) {
73  // std::cout << " Warning value in GetSeparation is below numerical precision "
74  // << diff/parentIndex
75  // << std::endl;
76  return 0;
77  }
78 
79  return diff;
80 }
TMVA::SdivSqrtSplusB
Implementation of the SdivSqrtSplusB as separation criterion.
Definition: SdivSqrtSplusB.h:44
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TMath::Sqrt
Double_t Sqrt(Double_t x)
Definition: TMath.h:691
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
b
#define b(i)
Definition: RSha256.hxx:100
TMVA::SdivSqrtSplusB::GetSeparationGain
virtual Double_t GetSeparationGain(const Double_t nSelS, const Double_t nSelB, const Double_t nTotS, const Double_t nTotB)
Separation Gain: the measure of how the quality of separation of the sample increases by splitting th...
Definition: SdivSqrtSplusB.cxx:58
TMVA::SdivSqrtSplusB::GetSeparationIndex
virtual Double_t GetSeparationIndex(const Double_t s, const Double_t b)
Index = S/sqrt(S+B) (statistical significance)
Definition: SdivSqrtSplusB.cxx:44
Double_t
double Double_t
Definition: RtypesCore.h:59
SdivSqrtSplusB.h
TMath.h