Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
GiniIndex.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 as separation criterion *
11 * Large Gini Indices (maximum 0.5) mean , that the sample is well *
12 * mixed (same amount of signal and bkg) *
13 * bkg. Small Indices mean, well separated. *
14 * general definition: *
15 * Gini(Sample M) = 1 - (c(1)/N)^2 - (c(2)/N)^2 .... - (c(k)/N)^2 *
16 * Where: M is a sample of whatever N elements (events) *
17 * that belong to K different classes *
18 * c(k) is the number of elements that belong to class k *
19 * for just Signal and Background classes this boils down to: *
20 * Gini(Sample) = 2s*b/(s+b)^2 *
21 * *
22 * Authors (alphabetical): *
23 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
24 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
25 * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
26 * *
27 * Copyright (c) 2005: *
28 * CERN, Switzerland *
29 * U. of Victoria, Canada *
30 * Heidelberg U., Germany *
31 * *
32 * Redistribution and use in source and binary forms, with or without *
33 * modification, are permitted according to the terms listed in LICENSE *
34 * (see tmva/doc/LICENSE) *
35 **********************************************************************************/
36
37/*! \class TMVA::GiniIndex
38\ingroup TMVA
39
40Implementation of the GiniIndex as separation criterion.
41
42Large Gini Indices (maximum 0.5) mean , that the sample is well mixed (same
43amount of signal and bkg) bkg.
44
45Small Indices mean, well separated.
46
47#### General definition:
48
49\f[
50Gini(Sample M) = 1 - (\frac{c(1)}{N})^2 - (\frac{c(2)}{N})^2 .... - (\frac{c(k)}{N})^2
51\f]
52
53Where:
54
55\f$ M \f$ is a sample of whatever \f$ N \f$ elements (events) that belong
56to \f$ K \f$ different classes.
57
58\f$ c(k) \f$ is the number of elements that belong to class \f$ k \f$ for just
59Signal and Background classes this boils down to:
60
61\f[
62Gini(Sample) = \frac{2sb}{(s+b)^2}
63\f]
64*/
65
66#include "TMVA/GiniIndex.h"
67
68#include "Rtypes.h"
69
71
72////////////////////////////////////////////////////////////////////////////////
73/// what we use here is 2*Gini.. as for the later use the factor
74/// 2 is irrelevant and hence I'd like to save this calculation
75
77{
78 if (s+b <= 0) return 0;
79 if (s<=0 || b <=0) return 0;
80 // else return s*b/(s+b)/(s+b);
81 else return 2*s*b/(s+b)/(s+b);
82}
83
84
#define b(i)
Definition RSha256.hxx:100
#define ClassImp(name)
Definition Rtypes.h:382
Implementation of the GiniIndex as separation criterion.
Definition GiniIndex.h:63
virtual Double_t GetSeparationIndex(const Double_t s, const Double_t b)
what we use here is 2*Gini.
Definition GiniIndex.cxx:76