Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/LICENSE) *
33 **********************************************************************************/
34
35/*! \class TMVA::GiniIndexWithLaplace
36\ingroup TMVA
37
38Implementation of the GiniIndex With Laplace correction as separation criterion
39
40Large Gini Indices (maximum 0.5) mean , that the sample is well mixed (same
41amount of signal and bkg) bkg.
42
43Small Indices mean, well separated.
44
45#### General definition:
46
47\f[
48Gini(Sample M) = 1 - (\frac{c(1)}{N})^2 - (\frac{c(2)}{N})^2 .... - (\frac{c(k)}{N})^2
49\f]
50
51Where:
52
53\f$ M \f$ is a sample of whatever \f$ N \f$ elements (events) that belong
54to \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
57Signal and Background classes this boils down to:
58
59The 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
61simple Gini Index for two classes
62
63\f[
64Gini(Sample) = \frac{2sb}{(s+b)^2}
65\f]
66
67turns into
68
69\f[
70GiniLaplace(Sample) = \frac{2(sb+s+b+1)}{(s+b+2)^2}
71\f]
72*/
73
75
76#include "Rtypes.h"
77
79
80////////////////////////////////////////////////////////////////////////////////
81
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
#define b(i)
Definition RSha256.hxx:100
#define ClassImp(name)
Definition Rtypes.h:382
Implementation of the GiniIndex With Laplace correction as separation criterion.
virtual Double_t GetSeparationIndex(const Double_t s, const Double_t b)