Logo ROOT   6.10/09
Reference Guide
GiniIndexWithLaplace.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : TMVA::GiniIndex *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: Implementation of the GiniIndex With Laplace correction *
11  * as separation criterion *
12  * Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2 *
13  * Where: M is a sample of whatever N elements (events) *
14  * that belong to K different classes *
15  * c(k) is the number of elements that belong to class k *
16  * Laplace's correction to the prob.density c/N --> (c+1)/(N+2) *
17  * for just Signal and Background classes this then boils down to: *
18  * Gini(Sample) = 2(s*b+s+b+1)/(s+b+2)^2 *
19  * *
20  * Authors (alphabetical): *
21  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
22  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
23  * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
24  * *
25  * Copyright (c) 2005: *
26  * CERN, Switzerland *
27  * U. of Victoria, Canada *
28  * Heidelberg U., Germany *
29  * *
30  * Redistribution and use in source and binary forms, with or without *
31  * modification, are permitted according to the terms listed in LICENSE *
32  * (http://tmva.sourceforge.net/LICENSE) *
33  **********************************************************************************/
34 
35 /*! \class TMVA::GiniIndexWithLaplace
36 \ingroup TMVA
37 
38 Implementation of the GiniIndex With Laplace correction as separation criterion
39 
40 Large Gini Indices (maximum 0.5) mean , that the sample is well mixed (same
41 amount of signal and bkg) bkg.
42 
43 Small Indices mean, well separated.
44 
45 #### General definition:
46 
47 \f[
48 Gini(Sample M) = 1 - (\frac{c(1)}{N})^2 - (\frac{c(2)}{N})^2 .... - (\frac{c(k)}{N})^2
49 \f]
50 
51 Where:
52 
53 \f$ M \f$ is a sample of whatever \f$ N \f$ elements (events) that belong
54 to \f$ K \f$ different classes.
55 
56 \f$ c(k) \f$ is the number of elements that belong to class \f$ k \f$ for just
57 Signal and Background classes this boils down to:
58 
59 The Laplace's correction to the probability distribution would turn the
60 \f$ \frac{c(1)}{N} \f$ into \f$ \frac{(c(1)+1)}{(N+2)} \f$ using this the
61 simple Gini Index for two classes
62 
63 \f[
64 Gini(Sample) = \frac{2sb}{(s+b)^2}
65 \f]
66 
67 turns into
68 
69 \f[
70 GiniLaplace(Sample) = \frac{2(sb+s+b+1)}{(s+b+2)^2}
71 \f]
72 */
73 
75 
76 #include "Rtypes.h"
77 
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 
82 Double_t TMVA::GiniIndexWithLaplace::GetSeparationIndex( const Double_t s, const Double_t b )
83 {
84  if (s+b <= 0) return 0;
85  if (s<=0 || b <=0) return 0;
86  else return (s*b+s+b+1)/(s+b+2)/(s+b+2);
87 }
88 
89 
Implementation of the GiniIndex With Laplace correction as separation criterion.
#define ClassImp(name)
Definition: Rtypes.h:336
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