Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/LICENSE) *
27 **********************************************************************************/
28
29/*! \class TMVA::SdivSqrtSplusB
30\ingroup TMVA
31Implementation 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
39
40////////////////////////////////////////////////////////////////////////////////
41/// Index = S/sqrt(S+B) (statistical significance)
42
44{
45 if (s+b > 0) return s / TMath::Sqrt(s+b);
46 else return 0;
47}
48
49////////////////////////////////////////////////////////////////////////////////
50/// Separation Gain:
51/// the measure of how the quality of separation of the sample increases
52/// by splitting the sample e.g. into a "left-node" and a "right-node"
53/// (N * Index_parent) - (N_left * Index_left) - (N_right * Index_right)
54/// this is then the quality criterion which is optimized for when trying
55/// to increase the information in the system (making the best selection
56
58 const Double_t nTotS, const Double_t nTotB)
59{
60 if ( (nTotS-nSelS)==nSelS && (nTotB-nSelB)==nSelB) return 0.;
61
62 Double_t parentIndex = (nTotS+nTotB) *this->GetSeparationIndex(nTotS,nTotB);
63
64 Double_t leftIndex = ( ((nTotS - nSelS) + (nTotB - nSelB))
65 * this->GetSeparationIndex(nTotS-nSelS,nTotB-nSelB) );
66 Double_t rightIndex = (nSelS+nSelB) * this->GetSeparationIndex(nSelS,nSelB);
67
68 //Double_t diff = parentIndex - leftIndex - rightIndex;
69 Double_t diff = (parentIndex - leftIndex - rightIndex)/(nTotS+nTotB);
70
71 if(diff<fPrecisionCut ) {
72 // std::cout << " Warning value in GetSeparation is below numerical precision "
73 // << diff/parentIndex
74 // << std::endl;
75 return 0;
76 }
77
78 return diff;
79}
#define b(i)
Definition RSha256.hxx:100
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Double_t GetSeparationGain(const Double_t nSelS, const Double_t nSelB, const Double_t nTotS, const Double_t nTotB) override
Separation Gain: the measure of how the quality of separation of the sample increases by splitting th...
Double_t GetSeparationIndex(const Double_t s, const Double_t b) override
Index = S/sqrt(S+B) (statistical significance)
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673