Logo ROOT   6.08/07
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 smaple 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 //_______________________________________________________________________
36 //
37 // Implementation of the GiniIndexWithLaplace as separation criterion
38 //
39 //_______________________________________________________________________
40 
42 
43 #include "Rtypes.h"
44 
46 
47 ////////////////////////////////////////////////////////////////////////////////
48 /// Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2
49 /// Where: M is a smaple of whatever N elements (events)
50 /// that belong to K different classes
51 /// c(k) is the number of elements that belong to class k
52 /// Laplace's correction to the prob.density c/N --> (c+1)/(N+2)
53 /// for just Signal and Background classes this then boils down to:
54 /// Gini(Sample) = 2(s*b+s+b+1)/(s+b+2)^2
55 
56 Double_t TMVA::GiniIndexWithLaplace::GetSeparationIndex( const Double_t &s, const Double_t &b )
57 {
58  if (s+b <= 0) return 0;
59  if (s<=0 || b <=0) return 0;
60  else return (s*b+s+b+1)/(s+b+2)/(s+b+2);
61 }
62 
63 
#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