Logo ROOT   6.07/09
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 #include "TMath.h"
30 #include "TMVA/SdivSqrtSplusB.h"
31 
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Index = S/sqrt(S+B) (statistical significance)
36 
37 Double_t TMVA::SdivSqrtSplusB::GetSeparationIndex( const Double_t &s, const Double_t &b )
38 {
39  if (s+b > 0) return s / TMath::Sqrt(s+b);
40  else return 0;
41 }
42 
43 
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Separation Gain:
47 /// the measure of how the quality of separation of the sample increases
48 /// by splitting the sample e.g. into a "left-node" and a "right-node"
49 /// (N * Index_parent) - (N_left * Index_left) - (N_right * Index_right)
50 /// this is then the quality crition which is optimized for when trying
51 /// to increase the information in the system (making the best selection
52 
54  const Double_t& nTotS, const Double_t& nTotB)
55 {
56  if ( (nTotS-nSelS)==nSelS && (nTotB-nSelB)==nSelB) return 0.;
57 
58  Double_t parentIndex = (nTotS+nTotB) *this->GetSeparationIndex(nTotS,nTotB);
59 
60  Double_t leftIndex = ( ((nTotS - nSelS) + (nTotB - nSelB))
61  * this->GetSeparationIndex(nTotS-nSelS,nTotB-nSelB) );
62  Double_t rightIndex = (nSelS+nSelB) * this->GetSeparationIndex(nSelS,nSelB);
63 
64  //Double_t diff = parentIndex - leftIndex - rightIndex;
65  Double_t diff = (parentIndex - leftIndex - rightIndex)/(nTotS+nTotB);
66 
67  if(diff<fPrecisionCut ) {
68  // std::cout << " Warning value in GetSeparation is below numerical presicion "
69  // << diff/parentIndex
70  // << std::endl;
71  return 0;
72  }
73 
74  return diff;
75 }
76 
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...
virtual Double_t GetSeparationIndex(const Double_t &s, const Double_t &b)
Index = S/sqrt(S+B) (statistical significance)
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
Abstract ClassifierFactory template that handles arbitrary types.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Double_t Sqrt(Double_t x)
Definition: TMath.h:464